Last active
June 3, 2018 14:07
-
-
Save sk22/5c493fe64b103c59e6c9c0ddb01c2709 to your computer and use it in GitHub Desktop.
Export Google Play Music playlist
This file contains hidden or 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
// Copy this into Chrome's debugger console | |
// This will output all (loaded/visible) songs to the console. | |
// Format: Title - Artist | |
// You can use this to port the playlist to another service, | |
// for example using http://spotlistr.herokuapp.com or http://www.playlist-converter.net | |
// Warning: Only the visible songs will be in the list, | |
// so a workaround is to click the "toggle device toolbar" button on the | |
// upper left of the debugger and set the device height really high (like 5000px), as needed. | |
// This will force Google Play Music to load all songs visible in the viewport. | |
// Hint: Wrap the whole script into `copy()` to copy everything to the clipboard. | |
Array.from(document.querySelectorAll('.song-table tr.song-row')) | |
.map(song => [ | |
song.querySelector('td[data-col="artist"]').textContent.trim(), | |
song.querySelector('td[data-col="title"]').textContent.trim() | |
]) | |
.reduce((pre, song) => `${pre}${song.join(' - ')}\n`, '') | |
// Include the following line only if you plan importing it to Spotify (which usually uses another format) | |
.replace(/(?!\s)\&(?=\s)|\(|\)|(?!\s)feat.?(?=\s)|(?!\s)vs.?(?=\s)|original mix/gi, '') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment