wysocki Posted January 10, 2017 Posted January 10, 2017 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?
junkew Posted January 10, 2017 Posted January 10, 2017 There seems to be an api https://6xq.net/pandora-apidoc/json/methods/ FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
wysocki Posted January 10, 2017 Author Posted January 10, 2017 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now