ShadowOfThePenguin Posted January 18, 2019 Posted January 18, 2019 I am currently writing a program that interfaces with Google Play Music using the _IE UDF. It is working quite well, except I need it to pull the Artist and Album information. I started by copying the entire html file and doing string functions to cut it down to just this information, but that was really inefficient. It would be really nice if I could just get the information in a more straight forward way. Other pieces of information I have been able to get the object and then read the property, for example: $Title = (_IEGetObjById($ID,"currently-playing-title")).title returns the title of the song. However when it comes to the artist and album the HTML looks like this: Quote <div class="currently-playing-details"> <div id="player-artist" class="player-artist" data-type="artist" data-id="Arq5rde3pgv5nt2cc5zr2fg54bu/Khalid" data-navigate="">Khalid</div> <div class="player-dash"> - </div> <div class="player-album" data-type="album" data-id="B4hgubrz7rtwagflkwquay4xfb4/Khalid/Suncity" data-navigate="">Suncity</div></div> I have managed to get the artist information using the following code: $Artist = _IEGetObjById($ID,"player-artist") $Artist = _IEPropertyGet($Artist,'innerhtml') So my question is, short of reading through the whole HTML to get the album information, is there a way to get the "data-navigate" info? I have searched quite hard for the answer to this, and have managed to optimize other sections of my code from additional information I have found on the forum, but this one has stumped me. Thank you so much for your assistance! I will attach my whole code in case this isn't enough information Google Play OSC Remote.au3
ShadowOfThePenguin Posted January 18, 2019 Author Posted January 18, 2019 So I opened up the _IE UDF and saw that is using javascript, so I bypassed the UDF and used javascript commands to get elements by class, and since there is only one element with the "player-album" class I was able to get that element then use the same propertyget command to get the album. The working code looks like this: $oAlbums = $ID.document.getElementsByClassName("player-album") for $oAlbum in $oAlbums $oAlbum = $oAlbum ExitLoop Next $sAlbum = _IEPropertyGet($oAlbum,'innerhtml') It appears that after 2 days of trying to figure this out, all I had to do was ask for help to figure it out. I am still interested in any other ideas that people have, working does not mean best practice. Thanks
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