This script takes in a Spotify URI for a track from a variable, looks up the track's info from the Spotify API, then searches for it on Apple Music using the iTunes Search API. It then opens that track in the Mac's Music app.
- Git clone this repo or download the ZIP
- Run
pip install -r requirements.txt
in the same folder as this code (or just install the modules inrequirements.txt
manually) - Create a
tokens.toml
file and add this in there:
client_id="123my456clientid789"
client_secret="123my456secret789"
replacing the stuff in the quotes with your Spotify API credentials. (No credentials are needed for the iTunes Search API.)
-
Change the Spotify URI in the variable at the top of the Python file.
-
Run the Python file.
This script is really basic, and it has no way of knowing if the track found on Apple Music is the same as the Spotify track. Ideally, it would check stuff like the music's duration and explicitness between the two to make sure it's the same song (but track names sometimes differ between the two services despite being the same song).