Skip to content

Instantly share code, notes, and snippets.

@ianthekid
Created September 28, 2018 21:07
Show Gist options
  • Save ianthekid/fe790f42f5fb23c8407b02d7ab2592d3 to your computer and use it in GitHub Desktop.
Save ianthekid/fe790f42f5fb23c8407b02d7ab2592d3 to your computer and use it in GitHub Desktop.
Copy playlists from Google Play Music to Spotify
/*
* See instructions on this page: https://community.spotify.com/t5/Desktop-Windows/Import-Google-Music-playlists-to-Spotify/td-p/1173080/page/3
* Then access this site: http://spotlistr.herokuapp.com/#/search/textbox
*/
//Copy/Paste in web browser console on any public playlist page for Google Play Music
function fReplace(thisString, thisThing, thatThing) {
let tLS = thisString;
while(tLS.includes(thisThing)){
tLS = tLS.replace(thisThing, thatThing);
}
return(tLS);
}
var playlist = document.querySelectorAll('.tracks tr.tracklist-entry');
var strBuilder = "";
for(var i =0; i<playlist.length ; i++) {
var l = playlist[i];
var title = l.querySelectorAll('div.track-title')[0].textContent;
var artist = l.querySelectorAll('div.artist')[0].textContent;
strBuilder = strBuilder + artist + ' | ' + title + '\r\n';
}
console.log(strBuilder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment