Skip to content

Instantly share code, notes, and snippets.

@billgeek
Last active March 4, 2019 12:12
Show Gist options
  • Save billgeek/e8f17d6bdf8ec9477814ea53862cbd8d to your computer and use it in GitHub Desktop.
Save billgeek/e8f17d6bdf8ec9477814ea53862cbd8d to your computer and use it in GitHub Desktop.
Get Songs from a Google Play Music playlist

Retrieving songs from a Playlist on Google Play Music

Here's a script that you can load into the Google Chrome debug window that, when called, will copy the current playlist to the clipboard.

Simply do the following:

  • Navigate (and authenticate) to Google Play Music
  • Go to your desired playlist
  • Open the debug window by pressing F12
  • Paste the script into the console window
  • Run the getCurrentPl method
  • Open Excel (or any text editor; the values are tab separated)
  • Press CTRL+V or Paste command from the menu

This was tested to be working today, 4 March 2019.

var copyToClipboard = function(strToCopy) {
var el = document.createElement('textarea');
el.value = strToCopy;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
}
var getCurrentPl = function() {
var plTitle = document.getElementsByTagName('h2')[0].innerText;
var songRows = document.getElementsByTagName("table")[0].getElementsByTagName("tr");
var totalContent = plTitle + '\r\n';
for(var i = 2; i < songRows.length - 1; i++) {
var songElements = songRows[i].getElementsByTagName("td");
var title = songElements[1].innerText;
var artist = songElements[3].innerText;
var album = songElements[4].innerText;
totalContent += title + '\t' + artist + '\t' + album + '\r\n';
}
copyToClipboard(totalContent);
console.log('Complete!');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment