Android Question okhttputils with delayed Javascript

mcqueccu

Well-Known Member
Licensed User
Longtime User
Hello, I am trying to get direct extracted youtube link from this website savefrom.net, But the httputils completes before the page is fully loaded, so I am unable to get the link.

The Link comes behind a download button and it seems its loaded by a javascript

I need help in extracting the link.
<a title="video format: 720" class="link link-download subname ga_track_events download-icon" download="Sony WH-1000XM4 Review- The Final Form!.mp4" data-quality="720" data-type="mp4" href="https://r3---sn-h5q7rn7l.googlevide...title=Sony+WH-1000XM4+Review-+The+Final+Form!" data-ga-event="send;event;result;click;101">Download</a>

B4X:
Sub btnGenerateLink_Click
    
    Dim modUrl As String  = "https://en.savefrom.net/18/#url=http://www.youtube.com/watch?v=bInJjmH31Hk&utm_source=youtube.com&utm_medium=short_domains&utm_campaign=www.ssyoutube.com"
    Dim ok As HttpJob
    ok.Initialize("",Me)
    
    ok.Download(modUrl)
    
    Wait For Jobdone(ok As HttpJob)
    
    If ok.Success Then
        Dim res As String
        res = ok.GetString       
        Log(res)
    End If
End Sub

1597348302782.png
 

JohnC

Expert
Licensed User
Longtime User
The problem is that HTTPjob will not run any javascript - so if the link is only generated at runtime in the page after some javascript has ran, then you can't use HTTPJob.

You can try to instead use a hidden webview (with javascript enabled and chromeclient added) and then extract and process the resulting HTML after webview loads the page.
 
Upvote 0
Top