Youtube and Spotify downloader
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
setx SPOTIFY_USER_ID your_user_id
setx SPOTIFY_CLIENT_ID your_client_id
setx SPOTIFY_CLIENT_SECRET your_client_secret
setx SPOTIFY_REDIRECT_URI 'http://localhost:8888/callback'
Alternatively, if you want to run this program from the current directory, you could use an environment file .env
and load the credentials from there.
Copy the sample .envsample
to .env
and set the credentials.
cp .envsample .env
NOTE: If you don't want to use the YoutubeDL functionality, you could set PAFY_BACKEND = "internal"
and proceed without installing youtube-dl
. However, this is NOT recommended, as Pafy's internal backend is known to be unstable.
To install all modules run pip install -r requirements.txt
python main.py
* Program Gets the deatils of the songs from spotify api (for spotify songs)
and youtube music api (for youtube songs)
* It then searches the song on youtube and extracts the youtube song url
* The song is then downloaded as m4a from youtube using pafy module
* Metadata are added to the m4a song (Artist, title, album, album art image)