Jump to content

Recommended Posts

Posted
 

 

 

vZL9Bje.png

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

 

Posted (edited)

#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
Posted

?

#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
Posted (edited)

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
Posted

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.
 
 
Posted (edited)

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...