Skip to content

Instantly share code, notes, and snippets.

@cybrox
Created January 28, 2016 07:58
Show Gist options
  • Save cybrox/77b6a259bf965ad5a19c to your computer and use it in GitHub Desktop.
Save cybrox/77b6a259bf965ad5a19c to your computer and use it in GitHub Desktop.
Extract song titles from the google music mini player
var songString = "";
var songEntries = document.getElementsByClassName('song-row');
for (var i = 0; i < songEntries.length; i++) {
var song = songEntries[i];
for (var j = 0; j < song.childNodes.length; j++) {
if (song.childNodes[j].getAttribute('data-col') == 'song-details') {
var col = song.childNodes[j].childNodes[2].childNodes[1];
songString += col.childNodes[1].childNodes[0].innerText + ' - ';
songString += col.childNodes[0].innerText + '\n';
}
}
}
console.log(songString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment