Downloads songs from Spotify My Musicor Spotify Playlist that you provide
Project description
spotify_dl
Downloads songs from any Spotify playlist or from your “My Music” collection.
Tell me more!
I wanted an easy way to grab the songs present in my library so I can download it & use it offline(Spotify still hasn’t launched here. Y U NO COME?). spotify_to_mp3 worked well but it relied on grooveshark, which unfortunately is no more.
So I wrote this script which mimics that library, but instead of downloading from grooveshark, it provides you with a file of youtube URLs which you can then plug into youtube-dl
How do I get this thing running?
Pre-requisite: You need Python 3+
Install using pip sudo pip3 install spotify_dl (use pip if your distro natively provides Python 3)
Create your Spotify app & fetch the client id and client secret from Spotify Developer Console. These keys then need to be assigned as SPOTIPY_CLIENT_ID, SPOTIPY_CLIENT_SECRET and SPOTIPY_REDIRECT_URI environment variables.
You can set environment variables in Linux like so:
export SPOTIPY_CLIENT_ID='your-spotify-client-id' export SPOTIPY_CLIENT_SECRET='your-spotify-client-secret' export SPOTIPY_REDIRECT_URI='your-app-redirect-url'
Windows users, check for this question for details on how you can set environment variables.
Note the redirect URL can be a valid URL, just ensure it matches with what you have entered in the developer console & in the environment variable above.
Create your YouTube API key & fetch the keys from Google Developer Console. Set the key as YOUTUBE_DEV_KEY environment variable as mentioned above.
Run the script using spotify_dl. spotify_dl accepts different parameters, for more details run spotify_dl -h. For most users spotify_dl -d -p playlist_id -u user_name -o download_directory should do where
playlist_id is the id of the playlist where songs need to be downloaded. If this is skipped then it will download songs ftom your “My Music” collection
user_name is the user name who created the playlist.
download_directory is the location where the songs must be downloaded to.
A first time run will require authentication; you will need to click on the URL prompted to authenticate. Once logged in, paste the URL back in.
To retrieve download songs as MP3, you will need to install ffmpeg.
Linux users can get them by installing libav-tools by using apt-get (sudo apt-get install -y libav-tools) or a package manager which comes with your distro
Windows users can download FFMPEG pre-built binaries from here. Extract the file using 7-zip to a foldrer and [add the folder to your PATH environment variable](http
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for spotify_dl-2.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f72de2d7fc86c48a1796baa28fac03196c436196a2059de28b03145090d9305 |
|
MD5 | 78b5ed1b9ef187f3fff16249cea65f07 |
|
BLAKE2b-256 | 8f48e59966a3613a976b7688297eaa22bd93525a2296ecc51bdde8adf5751d00 |