From Spotify's Groove to YouTube's Show: Seamless Conversion!
A simple python script to convert your Spotify playlist into YouTube playlist.
- Create a YouTube Playlist from Spotify playlist
- Sync a YouTube Playliset with Spotify playlist
- Sync multiple Playlists
- 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"
-
Python
-
Install all required package
pip install -r requirements.txt
- Create a new YouTube playlist from Spotify playlist
- Sync YouTube playlist with spotify playlist
- Sync multiple playlists
python main.py create SPOTIFY_PLAYLIST_ID
Usage: main.py create [OPTIONS] SPOTIFY_PLAYLIST_ID
Create a YouTube Playlist from Spotify Playlist
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.
It will open the browser for authorization. Sign up with your google account to create playlist.
Choose the desired options and provide the necessary details:
- Use the
--public
flag to create a public YouTube playlist. - Use the
--private
flag to create a private YouTube playlist. - Use the
-n
or--name
option to specify the name of the YouTube playlist. - Use the
-d
or--description
option to provide a description for the YouTube playlist. - Use the
-l
or--only-link
flag to retrieve only the link of the YouTube playlist without displaying logs. - Use the
-s
or--save-to-sync
flag to save the created playlist to the list of playlists to sync. Refer this
- Create a public YouTube playlist with a custom name and description:
python main.py create --public -n "My Playlist" -d "A collection of my favorite songs" SPOTIFY_PLAYLIST_ID
- Create a 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:
python main.py create -l SPOTIFY_PLAYLIST_ID
Usage: main.py sync [OPTIONS]
Sync your YouTube playlist with Spotify Playlist
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 alson open the browser for authorization. Sign up with your google account to sync playlist.
Sync a Spotify playlist with a 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.
When you need to sync it, just run
python main.py sync
It will sync all the playlists in that file.
To clear that file just run,
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.