Convert Spotify Playlist to YouTube Playlist
Python script to convert Spotify playlist to YouTube playlist.
- Convert Spotify playlist to YouTube Playlist
- Sync YouTube Playliset with Spotify playlist Sync Multiple Playlists
- Install Python (https://www.python.org/)
- Install all required package (After cloning the repo, inside the folder)
pip install -r requirements.txt
- 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.
- Go to the Credentials page in the API & Services section of the left sidebar.
- Click on the "Create Credentials" button and select "OAuth client ID".
- After creating select edit button in the OAuth 2.0 Client IDs, Select application type as Desktop App and then click create.
- Click the download button to download the credentials in your project directory. Rename the file to
client_secret.json
- Go to the OAuth consent screen in the API & Services section of the left sidebar. Under test user add your Gmail id.
- Go to the Spotify Developer Dashboard and log in with your Spotify account.
- Click on the "Create an App" button and fill out the necessary information, such as the name and description of your application.
- Once you've created the app, you'll be taken to the app dashboard. Here, you'll find your client ID and client secret, which are used to authenticate your application with the Spotify API.
- Add you client id and secert in
.env
file
CLIENT_ID="xxxxxxxxxxxxxxxxxx"
CLIENT_SECRET="xxxxxxxxxxxxxxxx"
- Create a new YouTube playlist from Spotify playlist
- Sync YouTube playlist with spotify playlist
- Sync multiple playlists
python main.py create [OPTIONS] SPOTIFY_PLAYLIST_ID
Browser will open for authorization. Sign into google account.
Options:
--public Create a public playlist
--private Create a public playlist
-n, --name TEXT Name of the YouTube playlist to be created
-d, --description TEXT Description of the playlist
-l, --only-link just only link of playlist, logs not appear
-s, --save-to-sync Save to list of playlist to sync
--help Show this message and exit. Refer sync-multiple-playlist section in ReadMe
Create YouTube Playlist from Spotify Playlist
python main.py create SPOTIFY_PLAYLIST_ID
- Create public YouTube playlist with custom Playlist Title and Description:
python main.py create --public -n "My Playlist" -d "A collection of my favorite songs" SPOTIFY_PLAYLIST_ID
- Create private YouTube playlist and save it to the list of playlists to sync:
python main.py create --private -s SPOTIFY_PLAYLIST_ID
- Get only the link of the YouTube playlist without displaying logs:
main.py sync [OPTIONS]
Options:
-s, --spotify_playlist_id TEXT Spotify playlist ID
-y, --youtube_playlist_id TEXT YouTube playlist ID
-l, --only-link just only link of playlist, logs not appear
--help Show this message and exit.
python main.py sync -s <spotify_playlist_id> -y <youtube_playlist_id>
-s
,--spotify_playlist_id
: Specifies the Spotify playlist ID to sync.-y
,--youtube_playlist_id
: Specifies the YouTube playlist ID to sync.-l
,--only-link
: Retrieves only the link of the playlist without displaying logs.
It also open browser for authorization. Sign into google account to sync playlist.
Sync Spotify playlist with YouTube playlist and retrieve only the link:
python main.py sync -s SPOTIFY_PLAYLIST_ID -y YOUTUBE_PLAYLIST_ID --only-link
When creating a playlist, just add --save-to-sync
or -s
flag to it. It save the Spotify and YouTube playlist id in playlists.json file.
Sync all playlists in that file -
python main.py sync
Clear file -
python main.py clear
Refer this blog post for more info
If you need more info or any support please feel free to contact me
Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.