Move Spotify playlist to Youtube Music using Python and Youtube Data V3 API
- Login to your Spotify Developer Account.
- Navigate to dashboard and then click create app.
- Fill out basic information about your app like name and description.
- In the redirect URI textbox, enter
http://localhost:8080
- Check the Web API option.
- Agree to the terms & conditions and click on save.
- Naviagte to settings of your app and copy client ID and client secret.
- Paste it in spotify_client.py file.
- Go to the Google Cloud Console, sign in with your Google account, and create a new project.
- Once your project is created, select it from the project dropdown menu in the top navigation bar.
- Click on the API & Services section in the left sidebar and navigate to Credentials page.
- Click on the "Create Credentials" button and select "OAuth client ID".
- At this point, you might be prompted to create an Auth Consent Screen if not already configured.
- While creating the client ID, enter
http://localhost:8080
under the 'Authorized JavaScript origins' section andhttp://localhost:8080/
this under the "Authorized redirect URIs" - Click save.
- Once created, download the JSON file containing the client ID and secret and move it to the root of your project folder.
- Rename the file to "client_secret.json"
- Revisit the OAuth Consent Screen and under the test user section add your Gmail id.
NOTE: The Youtube Data API V3 is free to use, however it has pre-determined quota of 10,000 units/day. These 10,000 units are enough to transfer about 200 songs in one go (tested personally). Once the units over, any further request to the endpoint would return a 403 error. The quota is reset at midnight pacific time (12 A.M PT = 1.30 PM IST, same day).
Clone the project
git clone https://github.com/dhruv-bvpdev/spotify-2-yt.git
Go to the project directory
cd spotify-2-yt
Required Packages
pip install google-auth google-auth-oauthlib google-auth-httplib2 spotipy pytube
Run the Script
python main.py <playlist_id>
NOTE: The playlist ID that needs to be used in the above command is the id of the same playlist you are trying to move to YT.
You can get this ID in the spotify playlist URL after playlist/