This tool exports the user's Google Music playlists to spotify.
pipenv install
pipenv shell
python3 main
See --help
for detailed flag usage.
Google does not have a public api for Google Music. As a consquence using this script violates the Google's terms of use. You have been warned. In order to make requests we must spoof a device that is already connected to your Google Music account. Fortuantely our Google Music library, simon-weber/gmusicapi, does most of the work. The easiest way to get a device id is for you to supply a dummy one on the command line, this will crash the app, but Google returns your device IDs in the error message (nice).
- Visit your spotify developer dashboard
- Create an app, the Client ID and Secret Should be immediately visible
- Click "Edit Settings"
- Add "http://localhost/" to "Redirect URIs". During the first execution of the script this will open your browser, authenticate you with Spotify then redirect you to "http://localhost/?code=...". Copy this URL (yes the entire thing) into your terminal when prompted.
Spotify and Google Music don't exactly see eye-to-eye on what they consider ways to favorite a track.
Google allows you to "thumbs up" tracks that you like.
Spotify allows you to save tracks you like and add them to playlists.
When you save a track or add it to a playlist Spotify infers that you like the song.
To import your Google "thumbs up" I recommend creating a new playlist from your "thumbs up"ed tracks.
Unfortunately the pre-created auto playlist is not accessible from outside of an official client so you will need to export these to a new playlist.
To do so, go to your "playlists" page in Google music find "Thumbs up" in the "Auto-playlists" section.
Mouse over it, and click the three-dots menu, select "Add playlist to playlist" > "New Playlist".
When you specify --favorites-playlist
make sure to supply the same name (capitilization matters!).