Convert an Apple Music playlist to a Spotify playlist
To use playlist-converter-lite, you must meet the following criteria:
pip install playlistconverterlite
Set your app's Spotify Client ID and Client Secret as SPOTIPY_CLIENT_ID and SPOTIPY_CLIENT_SECRET environment variables.
export SPOTIPY_CLIENT_ID=<your_client_id>
export SPOTIPY_CLIENT_SECRET=<your_client_secret>
You will also need to set an environment variable SPOTIPY_REDIRECT_URI, which tells the Spotify API where to redirect the user once they have successfully entered their login info.
export SPOTIPY_REDIRECT_URI=http://127.0.0.1:8080/
Also be sure to register the redirect URI in your app's settings on your Spotify Developer dashboard.
from playlistconverterlite import converter
new_playlist_link = converter.convert(
pl_id="SOME_PLAYLIST",
am_key="MY_KEY",
am_kid="MY_KEY_ID",
am_team_id="MY_TEAM_ID",
sp_username="SPOTIFY_UN"
)
https://github.com/andrewking1597/playlist-converter-lite/blob/main/LICENSE