Moving your playlists from Spotify to YouTube Music (Without losing tracks)

James Bond
6 min readApr 8, 2024

--

I’ve recently switched from Spotify to YouTube Music, and it’s been a pain.

Migrating playlists has been tedious, with most services out there either losing tracks, or being downright scammy .

Written below is a straightforward (I think) step-by-step guide to moving your playlists over, without emptying your wallet to pay for a shitty service.

(The only caveat being that it doesn’t seem to work for playlists with over a hundred tracks, sorry!)

We’re doing this through a script written in python, but there’s no coding experience required to follow along.

Step 1: Open up the Google Collab file

Here’s the link

You should see something like this:

The collab notebook page

You don’t really need to know what any of it does. I’ll walk you through it, step by step. You’ll probably want to save the file to your drive.

To begin with, hover your mouse over the first block of code (the ‘!pip install…’ statement).

A black ‘run’ icon appears to the left of the block. Click on it and wait for the code to run.

‘Run’ icon

Do the same for the second block of code (The one labelled ‘#import statements..’)

P.S. If you happen to be a programmer or a code-y person (which is more than likely considering we’re on medium), yes, I know my code sucks (structurally speaking). But hey, it does the job!

Step 2: Create a Spotify Developer Account

Second thing, go over to https://developer.spotify.com/ and sign in with your Spotify account.

Go to your ‘Developer Dashboard’ and click on ‘Create App’ (https://developer.spotify.com/dashboard)

You should see something like this:

You can put anything you want to under ‘App Name’ and ‘App description’.

For the Redirect URI, we’re using the placeholder ‘http://localhost’

Check ‘I agree with terms of Service’ then hit ‘Save’.

You’ll be redirected to your app home. Click on ‘Settings’ in the right hand corner.

App Home

You’ll then see ‘Basic Information’ page come up on your screen. Awesome.

‘Basic Information’ Page

Step 3: Client Id and Secret

You’re still on the ‘Basic Information’ screen right? Great.

You should see a field in front of you called ‘Client Id’ . Copy the client id to your clipboard.

Now, head on back over to the Collab notebook. The third block of code is labelled ‘spotify dev credentials’.

Paste your client ID in between the quotation marks next to ‘cid’.

cid = 'paste-your-client-id-here'

Switch back over to the ‘Basic Information’ tab (spotify for developers).

You’ll see a ‘View Client Secret’ option underlined. Click on it. Copy your client secret.

Now, back to the Collab page, paste your client secret in between the quotation marks next to ‘secret’.

secret = 'your-client-secret-goes-here'

Hit the ‘run’ icon that shows up on the left of the block. Wait for the code to run.

Hit ‘Run’ (circled in red)

Hurrah! The tricky bit is done. From here on out, It’s smooth sailing.

Step 3: Getting Your Username and Playlists

Next, head on over to Spotify Web.

(Make sure it’s the same account you logged into ‘Spotify for developers’ with)

Once you’re there, go to your account page then click on ‘edit profile’.

Near the top, you can see your ‘Username’ (which is a bunch of random numbers and characters)

Copy your username and go back to the code on google collab.

Paste your username in between the quotes next to ‘username’.

username = "paste-your-username-here"

Now, go back to the main Spotify page and open up the playlist you’d like to move (ensure the playlist is saved to your library).

Check the link of the playlist. It should be of the format,

https://open.spotify.com/playlist/playlist-id

Copy the ‘playlist-id’ portion of the link.

Then go back to the code and paste your playlist id (enclosed within quotes) next to the ‘p_ids’ within square brackets. Repeat for as many playlists as you like (separated by commas).

p_ids = ["first playlist id", "second playlist id", "third playlist id"] # list of playlist id's

Now hit the ‘run’ button next to the block of code.

Run

P.S. Here’s the playlist I’m moving:

Step 4: Loading Up your Playlists and Songs

Not much to do here.

For each of the following four blocks of code, hit the black ‘run’ button that comes up on the left.

Make sure to run them one by one , in chronological order. Wait for one block of code to finish running before moving on to the next.

Step 5: Authorize Your YT Account

We’ve done all we need to with Spotify! Now, we move on to YouTube Music.

Go down to the ‘#login to ytmusic’ block and run.

You’ll get a blue link. Click on it and login to your google account.

Then come back to the collab code, place your caret next to the word ‘abort’ and hit enter. (This stops the block from running)

Step 6: The final step

Nearly done! All that’s left is actually having the playlists made on YT Music.

Only one block of code remaining. Run it.

The last block of code left to run

The magic unfolds before your eyes.

We’ve done it! Hurrah!

Hurrah!

Note: Sometimes, when you’re moving a lot of playlists, YT Music will say you’re creating too many playlists too quickly. That’s ok. Just wait a while before running it again.

Disclaimer: The above code is provided as-is and may require adjustments based on changes to Spotify, YouTube Music, or the modules used above (spotipy, ytmusicapi). Use at your own risk.

--

--