A suite of helpful (to me) functions to transfer music (i.e. playlists) from Spotify to Tidal, and vice versa, using tidalapi and spotipy. The suite also helps copying playlists and tracks between two accounts of the same service (i.e. between two TIDAL accounts or between two Spotify accounts). Because Tidal does not have a public-facing API, if they change their URLs or requirements, this will break. Feel free to submit a bug report if it does and I'll try to fix it if I can.
Delete all your tidal playlists.
Move all your tidal playlists to spotify.
Move one of your tidal playlists to spotify. Takes a playlist ID
Move all of your spotify playlists to tidal.
Move all your favourites/liked/saved tracks from spotify to your favourites tracks in tidal.
Move a discovery weekly playlist on spotify to tidal. A minimal version of this repository that calls this function and is configured to run on my server is in this branch.
Copy all your TIDAL playlists from one account to another one.
Copy all your Spotify playlists from one account to another one. Displaying order is preserved.
Copy all your Spotify saved tracks from one account to another one. Chronological order (when the track was added) is preserved.
There are also connect_to_spotify
and connect_to_tidal
functions, which you must run before running any of the other functions. Both authenticate you and return either a spotipy or tidalapi session.
- Clone this repository
- Install the requirements:
pip install -r requirements.txt
- Create a secrets.py file:
touch secrets.py
- Copy and paste the following into the secrets file. You want numbers for both the tidal and spotify IDs, not your email address. See the sections below for how to obtain both your tidal and spotify IDs, as well as spotify client credentials. If you want to copy playlists and tracks from one TIDAL or Spotify account to another one, fill also the "_2" fields (e.g. copy FROM account with tidal_id TO account with tidal_id_2 or FROM account with spotify_id to account with spotify_id_2).
tidal_id = 'your_tidal_id'
tidal_username = '[email protected]'
tidal_pwd = 'your_tidal_password'
spotify_id = 'your_spotify_id'
spotify_username = '[email protected]'
SPOTIPY_CLIENT_ID = 'your_spotify_client_ID'
SPOTIPY_CLIENT_SECRET = 'your_spotify_client_secret'
SPOTIPY_REDIRECT_URI = 'http://localhost/'
spotify_discover_weekly_id = 'your_spotify_discover_weekly_id'
tidal_id_2 = 'your_tidal_id'
tidal_username_2 = '[email protected]'
tidal_pwd_2 = 'your_tidal_password'
spotify_id_2 = 'your_spotify_id'
spotify_username_2 = '[email protected]'
- Run script.py:
python script.py
. Right now, the script just signs into Spotify, signs into Tidal, and moves all Spotify songs to Tidal, but you can edit the script to run whatever functions you want. - ???
- Profit.
Go to your profile page on spotify, and click on the three dots > share > copy spotify URI. Then, when pasting the result into your secrets file, get rid of "spotify:user:" before the number.
Go to the tidal web player, login and then open the Network pane inside the Developer tools in Firefox. Look at the request URL: your id will be right after v1/users/. Example:
Go to your discover weekly playlist on spotify, and click on the three dots > share > copy playlist link. Then, when pasting the results into your secret file, copy the number between "https://open.spotify.com/user/spotify/playlist/" and "?si=bunchOfRandomThings".
For some reason, there is no Spotify how-to on this that I can find, so here it is:
- Go here, sign in with your spotify account, and register an app.
- Click on the app, and copy the client ID and client secret into your secrets file.
- Click 'edit settings' in the top right corner.
- Scroll down to 'Redirect URIs' and add 'http://localhost/'
- Save Now you should be able to log in when running the program. A window will pop up asking you to sign in, and then the program will continue running.
Eh, good enough. A lot of songs aren't found because of the discrepancies between the two platforms with song names and artist names (Admiral vs. The Admiral). Further, a lot of songs have addendums - "We Belong - Odesza Remix", or "Storm Returns (A Prefuse/Tommy Guerrero Interlude)". A more dedicated programmer might parse the song names, perhaps getting rid of anything after a dash or anything between parenthesis. But this doesn't work all the time (I want the Odesza remix of We Belong, not the original!). The Tidal library is also a lot smaller than the Spotify library, unfortunately. If you would like to submit a PR to make this part of the code more robust, I would greatly welcome it.