{"tag":"export","articles":{"blog\/technology\/exporting-playlists-from-google-play-music-to-spotify":{"key":"blog\/technology\/exporting-playlists-from-google-play-music-to-spotify","type":"article","published":true,"meta":{"createdAt":"2017-04-28T19:43:58+02:00","publishedAt":"2016-08-10T22:33:00+02:00","group":null,"category":"blog","subcategory":"technology","slug":"exporting-playlists-from-google-play-music-to-spotify"},"content":{"en":{"slug":"exporting-playlists-from-google-play-music-to-spotify","title":"Exporting playlists from Google Play Music to Spotify","intro":"\u003Cp\u003ESpotify is so much better than Google Play Music! Whether it\u2019s in the field of cool features (like using your smartphone to control the music on your computer) or just basic user experience (like ability to filter songs inside a playlist) \u2013 Spotify wins by far!\u003C\/p\u003E\u003Csvg xmlns=\u0022http:\/\/www.w3.org\/2000\/svg\u0022 style=\u0022display: none;\u0022\u003E\u003C\/svg\u003E","content":"\u003Cp\u003ESpotify is so much better than Google Play Music! Whether it\u2019s in the field of cool features (like using your smartphone to control the music on your computer) or just basic user experience (like ability to filter songs inside a playlist) \u2013 Spotify wins by far!\u003C\/p\u003E\n\u003Cp\u003EThere\u2019s just one thing that for the past two months was stopping me from migrating to Spotify. Neither in Spotify nor in GPM can you export or import a list of songs. Really! And I really don\u2019t have time to search for all my songs again...\u003C\/p\u003E\n\u003Cp\u003EFortunately, there\u2019s \u003Ca href=\u0022https:\/\/soundiiz.com\/\u0022 target=\u0022_blank\u0022 rel=\u0022noopener\u0022\u003E\u003Csvg class=\u0022icon\u0022\u003E\u003Cuse xlink:href=\u0022#light-link\u0022\u003E\u003C\/use\u003E\u003C\/svg\u003E Soundiiz\u003C\/a\u003E! This fancy tool allows you to migrate playlists between different streaming services. Among which... there\u2019s no GPM, because of course there isn\u2019t. Oh, damn you, Google!\u003C\/p\u003E\n\u003Cp\u003EWe can however upload a text file (in format \u003Ccode\u003EArtist\u00a0-\u00a0Title\u003C\/code\u003E for each line) to Soundiiz and it will automatically find our songs in the Spotify database, creating a playlist. Cool! So now we only have to create such file.\u003C\/p\u003E\n\u003Cp\u003EWe might just scrape the data from GPM\u2019s HTML, couldn\u2019t we? Well, Google doesn\u2019t make it easy. It loads the list of songs dynamically while you\u2019re scrolling... Oh, damn you, Google!\u003C\/p\u003E\n\u003Cp\u003EAnyways, my solution is:\u003C\/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOpen GPM, chose the playlist in that you\u2019d like to export.\u003C\/li\u003E\n\u003Cli\u003EOpen the JavaScript console (in Chrome it\u2019s \u003Ccode\u003ECtrl+Alt+J\u003C\/code\u003E, in Firefox \u003Ccode\u003ECtrl+Alt+K\u003C\/code\u003E).\u003C\/li\u003E\n\u003Cli\u003EPaste the following code:\u003C\/li\u003E\n\u003C\/ol\u003E\n\u003Cpre\u003E\u003Ccode class=\u0022hljs javascript border\u0022\u003E\u003Cspan class=\u0022hljs-keyword\u0022\u003Evar\u003C\/span\u003E fetched = [];\n\u003Cspan class=\u0022hljs-function\u0022\u003E\u003Cspan class=\u0022hljs-keyword\u0022\u003Efunction\u003C\/span\u003E \u003Cspan class=\u0022hljs-title\u0022\u003Efetch\u003C\/span\u003E(\u003Cspan class=\u0022hljs-params\u0022\u003E\u003C\/span\u003E) \u003C\/span\u003E{\n    \u003Cspan class=\u0022hljs-keyword\u0022\u003Evar\u003C\/span\u003E playlist = \u003Cspan class=\u0022hljs-built_in\u0022\u003Edocument\u003C\/span\u003E.querySelectorAll(\u003Cspan class=\u0022hljs-string\u0022\u003E\u0027.song-table tr.song-row\u0027\u003C\/span\u003E);\n    \u003Cspan class=\u0022hljs-keyword\u0022\u003Efor\u003C\/span\u003E(\u003Cspan class=\u0022hljs-keyword\u0022\u003Evar\u003C\/span\u003E i = \u003Cspan class=\u0022hljs-number\u0022\u003E0\u003C\/span\u003E; i \u0026lt; playlist.length; i++) {\n        \u003Cspan class=\u0022hljs-keyword\u0022\u003Evar\u003C\/span\u003E title = playlist[i].querySelectorAll(\u003Cspan class=\u0022hljs-string\u0022\u003E\u0027td[data-col=\u0022title\u0022] .column-content\u0027\u003C\/span\u003E)[\u003Cspan class=\u0022hljs-number\u0022\u003E0\u003C\/span\u003E].textContent;\n        \u003Cspan class=\u0022hljs-keyword\u0022\u003Evar\u003C\/span\u003E artist = playlist[i].querySelectorAll(\u003Cspan class=\u0022hljs-string\u0022\u003E\u0027td[data-col=\u0022artist\u0022] .column-content\u0027\u003C\/span\u003E)[\u003Cspan class=\u0022hljs-number\u0022\u003E0\u003C\/span\u003E].textContent;\n        \u003Cspan class=\u0022hljs-keyword\u0022\u003Evar\u003C\/span\u003E row = artist + \u003Cspan class=\u0022hljs-string\u0022\u003E\u0027 - \u0027\u003C\/span\u003E + title;\n        \u003Cspan class=\u0022hljs-keyword\u0022\u003Eif\u003C\/span\u003E (fetched.indexOf(row) == \u003Cspan class=\u0022hljs-number\u0022\u003E-1\u003C\/span\u003E) {\n            fetched.push(row);\n        }\n    }\n    \u003Cspan class=\u0022hljs-built_in\u0022\u003Econsole\u003C\/span\u003E.log(fetched.length);\n}\n\u003Cspan class=\u0022hljs-keyword\u0022\u003Evar\u003C\/span\u003E interval = setInterval(fetch, \u003Cspan class=\u0022hljs-number\u0022\u003E100\u003C\/span\u003E);\n\u003Cspan class=\u0022hljs-function\u0022\u003E\u003Cspan class=\u0022hljs-keyword\u0022\u003Efunction\u003C\/span\u003E \u003Cspan class=\u0022hljs-title\u0022\u003Edone\u003C\/span\u003E(\u003Cspan class=\u0022hljs-params\u0022\u003E\u003C\/span\u003E) \u003C\/span\u003E{\n    clearInterval(interval);\n    \u003Cspan class=\u0022hljs-built_in\u0022\u003Econsole\u003C\/span\u003E.log(fetched.join(\u003Cspan class=\u0022hljs-string\u0022\u003E\u0022\\n\u0022\u003C\/span\u003E));\n}\n\u003C\/code\u003E\u003C\/pre\u003E\n\u003Col start=\u00224\u0022\u003E\n\u003Cli\u003EScroll down through your playlist. You should see growing numbers appearing in the console. When you\u2019re done scrolling, this number should be equal to the number of songs in the playlist.\u003C\/li\u003E\n\u003Cli\u003EType \u003Ccode\u003Edone();\u003C\/code\u003E and you should see the list of your songs.\u003C\/li\u003E\n\u003Cli\u003ENow just copy-paste it to a file and save it.\u003C\/li\u003E\n\u003Cli\u003EGo to \u003Ca href=\u0022https:\/\/soundiiz.com\/\u0022 target=\u0022_blank\u0022 rel=\u0022noopener\u0022\u003E\u003Csvg class=\u0022icon\u0022\u003E\u003Cuse xlink:href=\u0022#light-link\u0022\u003E\u003C\/use\u003E\u003C\/svg\u003E Soundiiz\u003C\/a\u003E and connect with your Spotify account.\u003C\/li\u003E\n\u003Cli\u003EUpload the file.\u003C\/li\u003E\n\u003Cli\u003ERelax ;-)\u003C\/li\u003E\n\u003C\/ol\u003E\u003Csvg xmlns=\u0022http:\/\/www.w3.org\/2000\/svg\u0022 style=\u0022display: none;\u0022\u003E\u003C\/svg\u003E","tags":["export","google play music","javascript","music","playlist","spotify","streaming"],"hasMore":true,"image":null,"introLite":"\u003Cp\u003ESpotify is so much better than Google Play Music! Whether it\u2019s in the field of cool features (like using your smartphone to control the music on your computer) or just basic user experience (like ability to filter songs inside a playlist) \u2013 Spotify wins by far!\u003C\/p\u003E","contentLite":"\u003Cp\u003ESpotify is so much better than Google Play Music! Whether it\u2019s in the field of cool features (like using your smartphone to control the music on your computer) or just basic user experience (like ability to filter songs inside a playlist) \u2013 Spotify wins by far!\u003C\/p\u003E\n\u003Cp\u003EThere\u2019s just one thing that for the past two months was stopping me from migrating to Spotify. Neither in Spotify nor in GPM can you export or import a list of songs. Really! And I really don\u2019t have time to search for all my songs again...\u003C\/p\u003E\n\u003Cp\u003EFortunately, there\u2019s \u003Ca href=\u0022https:\/\/soundiiz.com\/\u0022 target=\u0022_blank\u0022 rel=\u0022noopener\u0022\u003E Soundiiz\u003C\/a\u003E! This fancy tool allows you to migrate playlists between different streaming services. Among which... there\u2019s no GPM, because of course there isn\u2019t. Oh, damn you, Google!\u003C\/p\u003E\n\u003Cp\u003EWe can however upload a text file (in format \u003Ccode\u003EArtist\u00a0-\u00a0Title\u003C\/code\u003E for each line) to Soundiiz and it will automatically find our songs in the Spotify database, creating a playlist. Cool! So now we only have to create such file.\u003C\/p\u003E\n\u003Cp\u003EWe might just scrape the data from GPM\u2019s HTML, couldn\u2019t we? Well, Google doesn\u2019t make it easy. It loads the list of songs dynamically while you\u2019re scrolling... Oh, damn you, Google!\u003C\/p\u003E\n\u003Cp\u003EAnyways, my solution is:\u003C\/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOpen GPM, chose the playlist in that you\u2019d like to export.\u003C\/li\u003E\n\u003Cli\u003EOpen the JavaScript console (in Chrome it\u2019s \u003Ccode\u003ECtrl+Alt+J\u003C\/code\u003E, in Firefox \u003Ccode\u003ECtrl+Alt+K\u003C\/code\u003E).\u003C\/li\u003E\n\u003Cli\u003EPaste the following code:\u003C\/li\u003E\n\u003C\/ol\u003E\n\u003Cpre\u003E\u003Ccode class=\u0022language-js\u0022\u003Evar fetched = [];\nfunction fetch() {\n    var playlist = document.querySelectorAll(\u0027.song-table tr.song-row\u0027);\n    for(var i = 0; i \u0026lt; playlist.length; i++) {\n        var title = playlist[i].querySelectorAll(\u0027td[data-col=\u0022title\u0022] .column-content\u0027)[0].textContent;\n        var artist = playlist[i].querySelectorAll(\u0027td[data-col=\u0022artist\u0022] .column-content\u0027)[0].textContent;\n        var row = artist + \u0027 - \u0027 + title;\n        if (fetched.indexOf(row) == -1) {\n            fetched.push(row);\n        }\n    }\n    console.log(fetched.length);\n}\nvar interval = setInterval(fetch, 100);\nfunction done() {\n    clearInterval(interval);\n    console.log(fetched.join(\u0022\\n\u0022));\n}\u003C\/code\u003E\u003C\/pre\u003E\n\u003Col start=\u00224\u0022\u003E\n\u003Cli\u003EScroll down through your playlist. You should see growing numbers appearing in the console. When you\u2019re done scrolling, this number should be equal to the number of songs in the playlist.\u003C\/li\u003E\n\u003Cli\u003EType \u003Ccode\u003Edone();\u003C\/code\u003E and you should see the list of your songs.\u003C\/li\u003E\n\u003Cli\u003ENow just copy-paste it to a file and save it.\u003C\/li\u003E\n\u003Cli\u003EGo to \u003Ca href=\u0022https:\/\/soundiiz.com\/\u0022 target=\u0022_blank\u0022 rel=\u0022noopener\u0022\u003E Soundiiz\u003C\/a\u003E and connect with your Spotify account.\u003C\/li\u003E\n\u003Cli\u003EUpload the file.\u003C\/li\u003E\n\u003Cli\u003ERelax ;-)\u003C\/li\u003E\n\u003C\/ol\u003E","words":377,"readTime":2,"lang":"en"}}}}}