Skip to content

A python script to add Songs from Spotify Playlists to YouTube Playlists.

Notifications You must be signed in to change notification settings

aditmodhvadia/SpotifyYouTubePlaylistManager

 
 

Repository files navigation

SpotifyYouTubeGeneratePlaylists

A simple python command line script that either converts your Spotify Playlists of songs to YouTube Playlist of videos or takes your liked videos on Youtube, and generates a Spotify playlist based on the song in your liked videos.

Table of Contents

Video

Check out the youtube video for a step by step walk through Youtube Video

Technologies

LocalSetup

  1. Install All Dependencies
    pip3 install -r requirements.txt

  2. Collect You Spotify User ID and Oauth Token From Spotify and add it to secrets.py file

    • To Collect your User ID, Log into Spotify then go here: Account Overview and its your Username alt text
    • To Collect your Oauth Token, Visit this url here: Get Oauth and click the Get Token button alt text
  3. Enable Oauth For Youtube and download the client_secrets.json

    • Ok this part is tricky but its worth it! Just follow the guide here Set Up Youtube Oauth ! If you are having issues check this out Oauth Setup 2 and this one too Oauth Setup 3
    • Note: Choose desktop client when selecting the application type.
  4. Run the File
    python3 create_playlist.py

    • You'll immediately see your browser opened and asking you to sign in into your google account. Select the appropriate account.
    • It will automatically collect your authorization code
    • You get to choose your option from the menu
    • Choose a playlist and it will create a YouTube playlist for you

Use cases

  1. Trying to play songs from Spotify Playlists on Discord server using Rhythm Bot manually? Convert your spotify playlist to Youtube playlist and just play the playlist
  2. Want to watch your favorite music playlists music videos on screen, convert your playlist using SpotifyYouTubeGeneratePlaylist
  3. And many more......

Limitation

  1. Google's API quota limit for a day is 10,000 counts. One search request costs 100 units and one playlist insert query costs 50 units. So I had to limit adding 50 videos per day.
  2. You have to manually update the Spotify authorization token after it expires every time.

ToDo

  • Tests
  • Add Error Handling
  • Pagination Handling (Spotify)
  • Workaround for Youtube Data API v3 daily quota limits for searching

Troubleshooting

  • Spotify Oauth token expires very quickly, If you come across a KeyError this could be caused by an expired token. So just refer back to step 3 in local setup, and generate a new token!
  • Google's API quota limit for a day is 10,000 counts. One search request costs 100 units and one playlist insert query costs 50 units. So I had to limit adding 50 videos per day.

About

A python script to add Songs from Spotify Playlists to YouTube Playlists.

Topics

Resources

Stars

Watchers

Forks

Languages

  • Python 100.0%