Skip to content

Instantly share code, notes, and snippets.

@muety
Last active November 29, 2019 19:55
Show Gist options
  • Select an option

  • Save muety/875c6bcfca79178ee1295c658f326b88 to your computer and use it in GitHub Desktop.

Select an option

Save muety/875c6bcfca79178ee1295c658f326b88 to your computer and use it in GitHub Desktop.
Export Deezer playlist to JSON
/*
1. Go to Deezer.com and open the playlist you want to export, e.g. https://www.deezer.com/en/profile/850026602/loved
2. Scroll down to the very bottom
3. Open your browser's dev tools (F12 on Linux an Windows) and go to the Console tab
4. Paste the following one-line command and hit enter
*/
JSON.stringify(Array.prototype.slice.call(document.getElementsByClassName('datagrid-row song')).map(r => Object.assign({}, {title: r.getElementsByClassName('title')[0].childNodes[0].textContent, artist: Array.prototype.slice.call(r.querySelectorAll('[itemprop="byArtist"]')).map(a => a.textContent).reduce((acc, a) => a + ', ' + acc, '').slice(0, -2)})), null, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment