Jump to content

Recommended Posts

Posted (edited)

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

Posted

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.
 

Posted

Thanks you @Juvigy
I will try to see what the Java Script code do to see if I can do it directly, I'm not very good with Java Script but I will try.

Thanks.

Posted

I checked superficially (so i could be wrong) and I find it easier you make it as instructed by Juvigy.

You can use the UI Automation (example) or something like this (like Juvigy suggestion).

 

Posted

Thanks you @MichaelHB
I would end with Juvigy suggestion because UI Automation is not that easy for me.
I think I will end up using it at the end but not now.

Regards
Alien.

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
×
×
  • Create New...