Jump to content

IE.au3: Howto grab all the embedded URLs?


rudi
 Share

Recommended Posts

Hi.

The IE is opening the requested URL just fine (IE Version 8.0.6001.18702, WinXP SP3), but then the script below is idleing in IE.AU3, line 558: that's inside the Func _IELoadWait() of IE.AU3, even though the page load seems to be finished?

#include <ie.au3>

If Not @Compiled Then Opt("trayicondebug", 1)

$Tagesschau = "http://www.tagesschau.de/export/video-podcast/tagesschau/"
ConsoleWrite("before IECreate" & @CRLF)
$oIE = _IECreate($Tagesschau) ; this isn't finished ever...
ConsoleWrite("Create done" & @CRLF)
$oURLs = _IELinkGetCollection($oIE)
ConsoleWrite("LinkGetCollection done" & @CRLF)
For $oLink In $oURLs
    ConsoleWrite($oLink.href & @CRLF)
Next

What do I miss?

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Different script - but it works a charm

#include <array.au3>

Local $rtn = GetPodcastLinks('http://www.tagesschau.de/export/video-podcast/tagesschau/')
If @error Then MsgBox(16, '', $rtn)
If Not @error Then _ArrayDisplay($rtn); <-- zero based array

Func GetPodcastLinks($podURL)
    Local $DLtimer = 0, $ec = 0
    Local $TempPage = @TempDir & '\podURL.htm'
    If FileExists($TempPage) Then FileDelete($TempPage)
    ;
    Local $DL_Page = InetGet($podURL, $TempPage, 1, 1)
    Do
        Sleep(1000)
        $DLtimer += 1
    Until InetGetInfo($DL_Page, 2) Or $DLtimer = 15
    ;
    If $DLtimer = 15 Then $ec = 1; Timed Out
    If InetGetInfo($DL_Page, 4) Then $ec = 2; Connection Error
    InetClose($DL_Page)
    If Not $ec = 0 Then Return SetError(-1, 0, $ec)
    Local $PodLinks = StringRegExp(FileRead($TempPage), '(?i)(?s)url="(.*?)"', 3)
    FileDelete($TempPage)
    If IsArray($PodLinks) Then Return SetError(0, 0, $PodLinks)
    Return SetError(-2, 0, 'Nothing To View')
EndFunc

-Edit-

Here's a smaller one that has less script abilities (error checking, etc.), but it gets the job done.

#include <array.au3>

Local $rtn = _GetPodcastLinks('http://www.tagesschau.de/export/video-podcast/tagesschau/')
If @error Then MsgBox(16, '', $rtn)
If Not @error Then _ArrayDisplay($rtn); <-- zero based array

Func _GetPodcastLinks($podURL)
    Local $DL_Page = InetRead($podURL, 1)
    If @error < 0 Then Return SetError(-1, 0, 'Connection Error')
    Local $PodLinks = StringRegExp(BinaryToString($DL_Page), '(?i)(?s)url="(.*?)"', 3)
    If IsArray($PodLinks) Then Return SetError(0, 0, $PodLinks)
    Return SetError(-2, 0, 'Nothing To View')
EndFunc
Edited by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

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...