Jump to content

Get _IE object property that has a dash in the key


Recommended Posts

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">&nbsp;-&nbsp;</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

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...