Skip to content

piyx/YoutubeToSpotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YoutubeToSpotify

A simple script to add all songs from youtube playlist to spotify playlist.

Example

What's different in version 2?

Faster: Uses Youtube API to get song info instead of selenium.
Convenient: No need to refresh token after every hour.
Reliable: Adds 85-95% of the songs from popular youtube playlists.

Note

Works only for public youtube playlists.

Stats

Added 142 songs to spotify playlist out of 150 songs from youtube playlist

Setup

1.Create an app: https://developer.spotify.com/dashboard/applications

2.Copy the Client id and client secret

3.Set redirect uri to http://localhost:8888/callback

Get youtube API key

CLICK HERE TO SEE HOW TO CREATE YOUTUBE API KEY

Setting Environment Variables Mac and Linux

  1. Rename the file .env.sample to .env

  2. Edit the file by adding your credentials

  3. Run the following command to set your environment variable source .env

Setting Environment Variables (Windows)

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'  
set YOUTUBE_API_KEY <your_youtube_api_key> 

Usage

$ python main.py

Output

Enter youtube playlist id: PLgzTt0k8mXzEpH7-dOCHqRZOsakqXmzmG
Enter a name for your spotify playlist: youtube_chill_songs   

The Chainsmokers - Takeaway was added to playlist.
KIRBY-Don't Leave Your Girl was not found!
Lauv - There's No Way was added to playlist.
.
.
.
Usher - Crash was added to playlist.

Example

Result

About

A Script which adds all songs from youtube playlist to a new spotify playlist.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages