Last active
April 29, 2020 19:42
-
-
Save jimbo8098/f5b352fdd4031686ad1d84539c2fc113 to your computer and use it in GitHub Desktop.
Outputs all songs currently in view on a Spotify playlist page and outputs a JSON array of those songs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go to https://open.spotify.com/playlist/7dhpGlWyXiRadoIgKKvubA?si=tF8elMqMSPazYUUzKivLgg&fbclid=IwAR0bNVYx-XV0ddKp9djpk5RxfpgERLqJOHk9Vjb7-amThYQwl-gl3j1gthM or something similar then run this in console | |
var songs = []; | |
var rows = document.getElementsByClassName("tracklist-row"); | |
for(var i = 0; i < rows.length; i++) | |
{ | |
var rowComps = rows[i].innerText.split("\n"); | |
if(rowComps[1] != "E") | |
{ | |
var song = { | |
"name": rowComps[0], | |
"artist": rowComps[1], | |
"album": rowComps[3] | |
} | |
} | |
else | |
{ | |
var song = { | |
"name": rowComps[0], | |
"artist": rowComps[2], | |
"album": rowComps[4] | |
} | |
} | |
songs.push(song); | |
} | |
console.log(JSON.stringify(songs)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment