Reading .JS Text

1 post in this topic

Hello All,

First time here so go easy on me.

I'm trying to get Autoit to getsource or readtext from this URL:

I'd like to use _INetGetSource to pull back all the text on that page so I can use _StringBetween and strip out the video URL:

However, I'm not able to get any text back.  

#include <IE.au3>
#include <String.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <INet.au3>
#include <array.au3>

Global $oIE, $wData[5]
Global $dailyURL
Global $updated
Global $weatherData
Global $tempData
Global $windData
$oIE = _IECreate("about:blank", 0, 0, 1, 0)

 Func Huffington()
 Local $queryURL = ""
    _IENavigate($oIE, $queryURL)
    $huffdata = _INetGetSource($queryURL)
    $dailyURL = _StringBetween($huffdata, '<h3><a href="', '" data-beacon=') ;this gets URL for Daily Morning Newsbrief
    $queryURL2 = $dailyURL[0]
    _IENavigate($oIE, $dailyURL[0]) ;navigates to daily morning newsbrief page
    $huffdata2 = _INetGetSource($queryURL2) ;reads source code of daily morning newsbrief page
    $videoJSURL = _StringBetween($huffdata2, 'src="//', '.js') ;gets video js URL
    $videoJSURL = "" & $videoJSURL[0] & ".js" ; the URL looks like this:
    $JSCode = _INetGetSource($videoJSURL)) ;THIS IS THE LINE I CAN'T GET TO WORK
    $RunVideo = _StringBetween($JSCode, 'videoUrls":["', '","')
    Run("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -new " & $RunVideo[0])
 EndFunc ;==> Huffington

Any help would be appreciated, thanks!

Share this post

Link to post
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