Jump to content

_IE Automation and InetGet problem - unable to handle JavaScript?


Recommended Posts

I'm doing another small script that Navigate to a Subtitles Website, find a TV Show and find the subtitles for that TV Show.
The problem is I can't use InetGet to download the desire subtitle because in that last step is java script involve.

This is what I have so far:

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

Local $oIE = _IECreate("www.tusubtitulo.com/series.php", 1, 1,1)

; TV Show to find in the Subtitles page Index
Local $sMyString = "The Blacklist"

; Get All Links on that page
Local $oLinks = _IELinkGetCollection($oIE)

;Declare Array for future use
Local $ShowLinks[1]

; Loop all links
For $oLink In $oLinks
    ; Get each Link's innerText
    Local $sLinkText = _IEPropertyGet($oLink, "innerText")

    ; If the innerText match my search create a new object
    If StringInStr($sLinkText, $sMyString) Then
        $oShow = _IECreate($oLink,1,1,1)

        ; Sleep here because when the page finish loading it have a delay to show subttitles list because is shown by JavaScript
        Sleep(3000)
        ; Get all links on that Specific show already found
        $oLinks = _IELinkGetCollection($oShow)
        ; Adding all the links to an Array
        For $oLink In $oLinks
            _ArrayAdd($ShowLinks,$oLink.href)
        Next
            _IEQuit($oIE)
        ExitLoop
    EndIf
Next

; Try to Donwload one specific Subtitle
$hDownload = InetGet($ShowLinks[139], @ScriptDir&"\sub1.str", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
_ArrayDisplay($ShowLinks)

Any help or advise would be nice, maybe there is a better way to do it, this is my first try using _IE UDF

Regards
Alien.

Edited by alien4u
Link to comment
Share on other sites

7 hours ago, Juvigy said:

Did you try to click on the link via IEACTION ? And then automate the dialog to save the file.

I can do that but I'm trying to use that as my last resource because I will download for example 20 subtitles and I will like to do that with IE in HIDE mode.

Regards
Alien.

Link to comment
Share on other sites

The java code fires on the onclick event event of the link i guess. You have to see what the java code does m because the link you get is not a link to the sub file. Thus you cant download it with INET.
 

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