A suite of helpful (to me) functions to transfer data from Spotify to Tidal, and vice versa, using tidalapi and spotipy. 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.
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.
tidal_id = 'your_tidal_id'
tidal_pwd = 'your_tidal_password'
spotify_id = 'your_spotify_id'
tidal_username = 'your_tidal_email_address@email.com'
spotify_username = 'your_spotify_email_address@email.com'
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'
- 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, click on your profile, copy the number in the url: https://listen.tidal.com/profile/thenumberyouwant.
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.