Generate CSV of Google Music Playlist

I recently switched my music vendor from Google Music to Spotify. To avoid manually searching for each song, I semi-automized the transition as follows.

1. Generate a CSV (artist, title) from your Google Music Playlist. Zoom your window out all the way (querySelectorAll will only load a static list of currently active rows).

// Run in Chrome's Developer Tools Console: Crtl+Shift+I
var playlist = document.querySelectorAll('.song-table');
for(var i =0; i<playlist.length ; i++) { 
  var l = playlist[i]; 
  var title = l.querySelectorAll('td[data-col="title"] .content')[0].textContent;
  var artist = l.querySelectorAll('td[data-col="artist"] .content')[0].textContent;
  console.log(artist.replace(","," ") + ',' + title.replace(","," ")); //take out "," to clean up CSV

Scroll and rerun until you have all entries.

2. Open your CSV in vim to remove the VM290:8 at the end of each entry. For example: Clamavi De Profundis,Far Over the Misty Mountains Cold VM290:8


Now you have a CSV file of arists, titles to do with what you wish. To proceed with migrating this playlist to Spotify specifically, continue to steps 3 & 4.

3. Copy/paste into Ivy.

4. Paste Ivy results into desired playlist.

Written on April 29, 2014