Jump to content

how to get the result link after search the website?


Recommended Posts

Depends on the browser you use. IE, FF ...?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Short answer (ie):

#include <IE.au3> 
_IELinkGetCollection(ByRef $o_object [, $i_index = -1])

Will return much more than you want.

Long ansower, loop through the above, and grab only the valid ones...they will all follow some pattern.

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.
Link to comment
Share on other sites

Here my code with IE, but why I dont use Filter with these link? and dont add $link[$i] to array?

#include <IE.au3>
 #include <Array.au3>
 #include <File.au3>


Local $oIE = _IECreate("http://www.youtube.com/results?search_query=ABCDE")
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
$link = 0
$linkend = 0
Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
For $oLink In $oLinks
    $sTxt &= $oLink.href & @CRLF
 Next
    $Finish = FileOpen("C:\temp.txt",  $FO_APPEND +  $FO_UTF8)
    FileWrite($Finish, $sTxt)
    _FileReadToArray("C:\temp.txt", $link)
for $i = 0 to $link[0]
   if $link[$i] = "http://www.youtube.com/watch?v=" Then
      _ArrayAdd($linkend, $link[$i])
   EndIf
Next
_ArrayDisplay($linkend, "")
Edited by langthang084
Link to comment
Share on other sites

How about:

#include <IE.au3>
#include <Array.au3>

Local $oIE = _IECreate("http://www.youtube.com/results?search_query=ABCDE")
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
$link = 0

$array = ""
Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
For $oLink In $oLinks
    $sTxt &= $oLink.href & @CRLF
    If StringInStr($oLink.href,"http://www.youtube.com/watch?v=") Then
        If IsArray($array) Then
            _ArrayAdd($array, $oLink.href)
        Else
            Local $array[1] = $oLink.href
        EndIf
    EndIf
Next
_ArrayDisplay($linkend, "")
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.
Link to comment
Share on other sites

some magic in any browser by entering this in the addressbar (google for favlets/bookmarklets) and you read out the alertbox

javascript:var list = document.getElementsByTagName("a"); alert([].slice.call(list).toString());void(0);

or more subtle thru addressbar and result in a newly created textbox (which you can read thru iuiautomation)

javascript: var list = document.getElementsByTagName("a");var textbox = document.createElement('input');textbox.type = 'text';document.body.appendChild(textbox);textbox.value=[].slice.call(list).toString();void(0);

be aware that with copy/paste you can loose text: javascript:

and with this you can automate all major browsers easily

'?do=embed' frameborder='0' data-embedContent>>

Edited by junkew
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...