wysocki

Pandora - still a problem with IE

3 posts in this topic

There are a few threads about accessing info from the Pandora website but they're pretty old and don't work with the current Pandora site. I've been trying to just scrape the station/artist/album/title info from the site so that I could broadcast it around the house from my inhouse webserver in my HTPC. Although I'm ok with html/css/jquery, I'm way out of my league with whatever coding was done on that site! I have used the IE.au3 functions and have somehow pulled out three strings that I figured I could just parse out to get to the info I want.

  • data-qa="playing_artist_name">Eagles</a>
  • data-qa="playing_album_name">Hotel California</a>
  • data-qa="station_active_name">70s Lite Rock Radio</span>

Now that I've tinkered with the code a bunch I can't even extract these strings anymore! Here's the code that I'm currently using. It extracts a lot of code but I find no reference to these strings!

#include <IE.au3>
#include <File.au3>
#include <String.au3>

$oIE = _IECreate("http://www.pandora.com/station/play/3460370738080498589", 0, 1, 1) ; Create Pandora window
$oFrame = _IEFrameGetCollection($oIE, -1)
ConsoleWrite('FrameCount:' & @extended & @CRLF)
$data   = _IEPropertyGet($oFrame, "innerhtml")
ConsoleWrite($data & @CRLF)
_IEQuit($oIE)

Figuring that there must be frames involved since FrameCount=2 , I came up with this snippet:

#include <IE.au3>
#include <File.au3>
#include <String.au3>

$oIE = _IECreate("http://www.pandora.com/station/play/3460370738080498589", 0, 1, 1) ; Create Pandora window
$oFrames = _IEFrameGetCollection($oIE);
$iNumFrames = @extended ; number of frames
ConsoleWrite('Frames:' & $iNumFrames & @CRLF)
For $i = 0 to ($iNumFrames -1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    ConsoleWrite('HTML:' & _IEPropertyGet($oFrame, "innerhtml"))
Next
_IEQuit($oIE)

Which gives me an error in the console:

Frames:2
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (2309) : ==> Variable must be of type "Object".:
Return SetError($_IEStatus_Success, 0, $oTemp.innerHTML)
Return SetError($_IEStatus_Success, 0, $oTemp^ ERROR

This is pretty much right out of the help file example. What am I doing wrong to get the data from the site?

Share this post


Link to post
Share on other sites



I saw the api, but since it says "unofficial" I'm not sure it even applies to the current version. I checked out some of the "implementations" they list, but not being a programmer in those languages, I didn't get much out of it.  Going to study up on the WinHttp stuff and see if I can figure it out.

Any helpful pointers here really welcomed. :)

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