Skip to content

Instantly share code, notes, and snippets.

@Mathspy
Created June 24, 2018 22:08
Show Gist options
  • Save Mathspy/e56ae92cfbf153fbadc95621ff03fe71 to your computer and use it in GitHub Desktop.
Save Mathspy/e56ae92cfbf153fbadc95621ff03fe71 to your computer and use it in GitHub Desktop.
Turns a Spotify playlist into an array for copying
Array.from(document.querySelectorAll(".track-name-wrapper")).map(node => {
let temp = {}
temp.name = node.firstElementChild.textContent
let artistAlbum = node.lastElementChild.querySelectorAll("a")
temp.artist = {name: artistAlbum[0].textContent, link: artistAlbum[0].href}
temp.album = {name: artistAlbum[1].textContent, link: artistAlbum[1].href}
return temp
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment