Some simple Python 3 scripts to help you into importing your existing Spotify playlists into Apple Music.
The first step is getting the songs you want to import into Apple Music into a CSV file. The simplest way to do this is using Exportify.
If you want to export you whole Spotify library, simply create a new playlist called All and drag your whole library into it using the Spotify desktop app. You can then export the playlist All using Exportify. Save the resulting file as spotify.csv in the same directory as the directory you cloned this repo into.
In order to add songs to our Apple Music playlist, we need their Apple Music identifier. Running python3 retrieve-identifiers.py
will use the spotify.csv file to create a new file itunes.csv with each line consisting of the Apple Music identifier of a song in your Spotify playlist.
And now, all songs that haven't match any Apple Music identifiers are added to a noresult.txt file.
https://amp-api.music.apple.com/v1/me/library/playlists/p.ID/tracks
(p.ID
stands; of course, for the unique playlist ID. So, don't search for the exact same url! You won't find it.)python3
. Then, quickly import pyautogui. (Make sure you have it installed before)pyautogui.position()
. It should return a tuple with two numbers. Replace the numbers in the line 14 and in the line 17 with the numbers you got from the terminal.Now you should be ready to go. When the script run, just select your browser window and wait for the magic to happen.
The script I'm using to retrieve the Apple Music identifier for a Spotify song is quite basic. It simply compares the title and artist to find out if a Spotify and Apple Music song match. Some songs don't have the exact same title (extraneous spacing for example) in both services. This results in the script failing to retrieve an identifier for some songs. Hopefully, you'll be able to add the missing songs manually thanks to the noresult.txt file.