Jump to content
Sign in to follow this  
NguyenMap

Get Link Google

Recommended Posts

NguyenMap
 

 

 

vZL9Bje.png

I can get 10 link of GG checker. DO you Help ME? Thank you very much.

 

Share this post


Link to post
Share on other sites
NguyenMap

I want to get top 10 link google check with dork = autoit.

After save link google and export to $KQ.

Thank you support.

Share this post


Link to post
Share on other sites
jvds

#include <IE.au3>
#include <array.au3>

$searchword="autoit"

$oIE  = _IECreate('about:blank')
_IENavigate($oIE, "http://www.google.com.py/search?q="&$searchword)
$oDiv = _IEGetObjById($oIE, "rso")
$array = $oDiv.innerhtml
$array = StringSplit($array,'<li class="g">',1)
_IEQuit($oIE)

$results=""
for $items = 1 to $array[0]
    $urlStart = StringInStr ($array[$items],'event)" href="') + StringLen('event)" href="')
    $urlEnd = StringInStr ($array[$items],'">',1,1,$urlStart)
    if $urlStart <> 0 and $urlEnd <> 0 and $urlStart < $urlEnd and StringInStr ($array[$items],'http') Then
        $url = StringMid($array[$items],$urlStart,$urlEnd-$urlStart)
        $results&=$url&'º'
        ConsoleWrite("$url="&$url&@LF)
    EndIf
Next
$results=StringTrimRight($results,1)
$results=StringSplit($results,'º')
_ArrayDisplay($results,"")

maybe this will work

Edited by jvds

Share this post


Link to post
Share on other sites
mikell

?

#include <ButtonConstants.au3>
      #include <EditConstants.au3>
      #include <GUIConstantsEx.au3>
      #include <WindowsConstants.au3>
      #include <IE.au3>
      #include <MsgBoxConstants.au3>
      #include <Inet.au3>

      $Form1 = GUICreate("GG GetLink", 715, 438, 192, 124)
      $Link = GUICtrlCreateInput("http://www.google.com.vn/search?q=", 16, 8, 250, 21)
      $Dork = GUICtrlCreateInput("autoit", 280, 8, 129, 21)
      $Ok = GUICtrlCreateButton("OK", 432, 8, 75, 25)
      $Cancel = GUICtrlCreateButton("Cancel", 520, 8, 75, 25)
      $Group1 = GUICtrlCreateGroup("Group1", 16, 48, 393, 369)
      GUICtrlCreateGroup("", -99, -99, 1, 1)
      $KQ = GUICtrlCreateEdit("", 432, 56, 261, 361)
      GUISetState(@SW_SHOW)

      $oIE =  _IECreateEmbedded()
      $Web =  GUICtrlCreateObj($oIE, 16, 48, 393, 369)
      $Url =  _IENavigate($oIE,"http://google.com")
      _IELoadWait($Url)
      GUISetState(@SW_ENABLE,$Form1)

      $oLink = GUICtrlRead($Link) & GUICtrlRead($Dork)
 
      While 1
              $nMsg = GUIGetMsg()
              Switch $nMsg
                      Case $GUI_EVENT_CLOSE
                              Exit
                      Case $Ok
                              $url=_IENavigate ($oIE, $oLink)
                              _IELoadWait($url)
                              GUISetState(@SW_ENABLE,$Form1)
                              GetLink()
              EndSwitch
      WEnd
       
      Func GetLink()
              Local $iNumLinks, $sTxt
              $Source = _IELinkGetCollection($oIE)
              For $oLink In $Source
                     $sHref = $oLink.href
                     If StringInStr($sHref , "url") and not StringInStr($sHref , "webcache") Then 
                           $sUrl = StringRegExpReplace($sHref , '.+url=([^&]+).+', "$1")
                           $sTxt &= $sUrl & @CRLF
                           $iNumLinks += 1
                     EndIf
              Next
              $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF & $sTxt
              GUICtrlSetData ($KQ, $sTxt)
      EndFunc

Share this post


Link to post
Share on other sites
NguyenMap

Thank for support jvds & mikell , thank you so much !!!

@jvds : Code very good, but i can't use it with my code :(. Can you help me?

@mikell : not run :(

Share this post


Link to post
Share on other sites
NguyenMap

@For all : Can you help me get DOM in web?

Share this post


Link to post
Share on other sites
NguyenMap

VAZcHGZ.png

Thank for all, i can get top 10 link on Page 1 of GOOGLE. Now i want to click page 2 , and tools auto write 10 link of page 2 in to $KQ. Help me...

Thank you.

Edited by NguyenMap

Share this post


Link to post
Share on other sites
NguyenMap

yes man, i write it

Share this post


Link to post
Share on other sites
Bert

ok, then I'm confused. Why do you need hundreds of links? I'm confused as to the value add to your need. I'm sure you have a good reason, but I've always found after the first 50 or so search results what you get is mostly garbage one has to weed through.

Share this post


Link to post
Share on other sites
Bert

now if you want 100 links then just change your google settings before you do your search. You can do that by following this:

 
1. Go to search setting.
2. De-select Google instant.
2. Keep the number of results at 10.
3. Save your preferences.
4. Return again to search setting.
5. Change the number of results displayed to 100 (or whatever you want),
6. Save again your preferences.
 
 

Share this post


Link to post
Share on other sites
NguyenMap

@MBALZESHARI : thank you support for me, i want to learn all code web..

Share this post


Link to post
Share on other sites
NguyenMap

oh sorry MBALZESHARI

i want learn all code autoit about web :D

Share this post


Link to post
Share on other sites
NguyenMap

who can help me pls?

i want click page 2 on Navigate and tool add links page 2 in $KQ

Share this post


Link to post
Share on other sites
jdelaney

Here, this grabs all those links on the 'google' search result pages:

#include <ie.au3>
; search results already present
$oIE = _IEAttach("Google Search")

$aLinks = BGe_IEGetDOMObjByXPathWithAttributes($oIE, "//a[@class='fl' and contains(@href,'start=')]")

For $i = 0 To UBound($aLinks)-1
    ConsoleWrite($aLinks[$i].href & @CRLF)
Next

Use the function in my signature (IEbyXPATH)...output:

https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=10&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=20&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=30&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=40&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=50&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=60&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=70&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=80&sa=N
https://www.google.com/search?q=something&safe=off&biw=944&bih=944&ei=ozz9U6rkMIKmigLXloHQBA&start=90&sa=N

Or, to specifically get the link to the next page:

#include <ie.au3>
; search results already present
$oIE = _IEAttach("Google Search")

$aLinks = BGe_IEGetDOMObjByXPathWithAttributes($oIE, "//a[@class='fl' and contains(@href,'start=10')]")

For $i = 0 To UBound($aLinks)-1
    ConsoleWrite($aLinks[$i].href & @CRLF)
    _IEAction($aLinks[$i],"focus")
    _IEAction($aLinks[$i],"click")
Next
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
NguyenMap

i can't use your code in google :(

When i run code, it direct to usrl autoit.com not google :(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×