Converts a youtube music playlist to spotify playlist.
- Support public playlists
- Support private playlists
- Auto create or update playlist if it already exists
- Use fuzzy search to find the best match
- Copy playlist thumbnail from youtube to spotify
- Copy playlist description from youtube to spotify
- Limit number of songs in the playlist
- Dry run mode to test without adding to spotify
- Create a new app: https://developer.spotify.com/dashboard
- Set "Redirect URI" to
http://localhost:8888/callback
- Copy the "Client ID" and "Client Secret" to use later
- Rename the file
.env.sample
to.env
- Edit the file by adding your credentials
- Run the following command to set your environment variable
source .env
set SPOTIFY_USER_ID <your_user_id>
set SPOTIFY_CLIENT_ID <your_client_id>
set SPOTIFY_CLIENT_SECRET <your_client_secret>
set SPOTIFY_REDIRECT_URI 'http://localhost:8888/callback'
pip install -r requirements.txt
$ source .env
$ python src/main.py -h
usage: main.py [-h] -yt YOUTUBE_URL_OR_ID
[-sp SPOTIFY_URL_OR_ID | -spname SPOTIFY_PLAYLIST_NAME]
[-n | -d] [-l LIMIT]
options:
-h, --help show this help message and exit
-yt YOUTUBE_URL_OR_ID, --youtube-url-or-id YOUTUBE_URL_OR_ID
Youtube Playlist URL or ID
-sp SPOTIFY_URL_OR_ID, --spotify-url-or-id SPOTIFY_URL_OR_ID
Spotify Playlist URL or ID
-spname SPOTIFY_PLAYLIST_NAME, --spotify-playlist-name SPOTIFY_PLAYLIST_NAME
Spotify Playlist Name (Default: Youtube Playlist Name)
-n, --create-new Force create a new playlist
-d, --dryrun Do not add to Spotify
-l LIMIT, --limit LIMIT
Limit the number of songs to fetch
# Pass any link containing a youtube playlist ID
# Sets same name as youtube playlist
$ python src/main.py -yt "https://music.youtube.com/playlist?list=RDCLAK5uy_lBNUteBRencHzKelu5iDHwLF6mYqjL-JU"
# Pass just the youtube playlist ID
# Set a custom name for the playlist
$ python src/main.py -yt "CLAK5uy_lBNUteBRencHzKelu5iDHwLF6mYqjL-JU" -spname "Pop Certified"
# Pass an existing spotify playlist URL or ID
# Limit the number of songs to fetch
# Dry run mode
$ python src/main.py -yt "CLAK5uy_lBNUteBRencHzKelu5iDHwLF6mYqjL-JU" -sp "https://open.spotify.com/playlist/6DyIxXHMwuEMbsfPTIr9C8?si=088e0b2f3a0446b6" -l 10 -d
# Pass even the URL of video playing from playlist
# Force create a new playlist
$ python src/main.py -yt "https://www.youtube.com/watch?v=RlPNh_PBZb4&list=RDCLAK5uy_lBNUteBRencHzKelu5iDHwLF6mYqjL-JU" -n
Note
Forked from @edgarh22's Youtube-to-Spotify-Archiver.