Jump to content

Get Link Google


Recommended Posts

@aNewLyfe : Code very good man :D, i can use it get all link. But i want you teach me , auto load url of google in sript. We don't write link in $baselink and $search. We click link in web and script auto run get link.

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


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$KQ = GUICtrlCreateEdit("", 16, 16, 465, 401)
GUICtrlSetData(-1, "")
$Run = GUICtrlCreateButton("Run", 512, 16, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Run
            Get()


    EndSwitch
WEnd

Func Get()
    $baselink = "https://www.google.com.vn/search?output=search&sclient=psy-ab"
    $search = "SEARCH+TEXT"
    $results = ""
    for $i=0 to 100 step 10
        $currentlink = $baselink&"&q="&$search&"&start="&$i
        $source = _InetGetSource($currentlink)
        $eachlink = _StringBetween($source,'<a href="/url?q=','&amp;sa=U')
        if isArray($eachlink) then
            for $z=0 to ubound($eachlink)-1
                If StringInStr($eachlink[$z], "://") Then
                    $Link = $eachlink[$z]
                    $results &= $Link&@CRLF
                    GUICtrlSetData ($KQ, $results)
                EndIf
            next
        endif
    Sleep(10000)
    next
EndFunc
Link to comment
Share on other sites

  • 5 years later...
  • Developers
6 minutes ago, ngthanhdam said:

hello, im newbie , this code not run

Hi newbie, telling us it doesn't run doesn't mean anything! 

Provide the needed details like errors or whatever you do see so we understand.
On the other hand: You do realise that this thread is 5 years old and the code might be outdated?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

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