Skip to content

Instantly share code, notes, and snippets.

@vfalconi
Last active October 1, 2019 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfalconi/9adaa8a00ed174334a7ceca0923151a1 to your computer and use it in GitHub Desktop.
Save vfalconi/9adaa8a00ed174334a7ceca0923151a1 to your computer and use it in GitHub Desktop.
Open a playlist in Spotify's web player UI. Do the infinite scroll trigger until the entire playlist is visible. Run this in the DevTools console to get a CSV-friendly version of the playlist copied to your clipboard. Paste into a text editor. Save as CSV.
copy(Array.from(document.querySelectorAll('.tracklist-container:not(.PlaylistRecommendedTracks__list) .tracklist-row')).map(row => {
const artists = Array.from(row.querySelectorAll('.tracklist-row__artist-name-link')).map(artist => artist.innerHTML).join(', ');
const title = (row.querySelector('.tracklist-name') !== null ? row.querySelector('.tracklist-name').innerHTML : row.querySelector('.TrackListRow__artists').innerHTML);
const album = (row.querySelector('.tracklist-row__album-name-link') !== null ? row.querySelector('.tracklist-row__album-name-link').innerHTML : row.querySelector('.TrackListRow__album').innerHTML);
return `"${title}","${artists}","${album}"`;
}).join("\n"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment