Skip to main content

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+

  1. Install using pip sudo pip3 install spotify_dl (use pip if your distro natively provides Python 3)

  2. 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.

  3. Create your YouTube API key & fetch the keys from Google Developer Console. Set the key as YOUTUBE_DEV_KEY environment variable as mentioned above.

  4. Run the script using spotify_dl. spotify_dl accepts different parameters, for more details run spotify_dl -h.

For most users spotify_dl -l spotify_playlist_link -o download_directory should do where

  • spotify_playlist_link is a link to Spotify’s playlist. You can get it from the 3-dot menu.

image

image

If the Spotify playlist link is skipped then it will download songs from your “My Music” collection - download_directory is the location where the songs must be downloaded to. If you give a . then it will download to the current directory.

Alternatively, spotify_dl -p playlist_id -u user_name -o download_directory will also work

  • 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.

  1. 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.

  2. To retrieve download songs as MP3, you will need to install ffmpeg. If you prefer to skip MP3 conversion, pass -m or --skip_mp3 as a parameter when running the script

  • 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

Credits

Issues, Feedback, Contact details

Feel free to raise any bugs/issues under Github issues. Pull requests are also more than welcome. You can reach me on twitter at [@sathyabhat](https://twitter.com/sathyabhat) or drop an email sathya@sathyasays.com

Metadata

Release files for spotify-dl 2.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotify-dl 2.5.1
File Size Uploaded
spotify_dl-2.5.1.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotify-dl 2.5.1
File Interpreter ABI Platform
spotify_dl-2.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / spotify_dl-2.5.1.tar.gz

Download URL spotify_dl-2.5.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
339d979b6d75a2ed12f9d772c6f9b9d9a753985b0773c02b1fe835981c9f9ec5
BLAKE2b-256 checksum
How to use checksums
b5a47d4306976e75f7ef95202ccb39495764b8ea2b7784120b32f4cdfb8704dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / spotify_dl-2.5.1-py3-none-any.whl

Download URL spotify_dl-2.5.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c79a8049d42e251232860e91b110e497a76635d5f5a057a1bf3d5a0504124884
BLAKE2b-256 checksum
How to use checksums
a25776686c6599ea7a1041c2967d9d242efb50be782dad9af2286c3d959011bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

8.9.0

2 release files

8.8.2

2 release files

8.8.1

2 release files

8.8.0

2 release files

8.7.0

2 release files

8.6.0

2 release files

8.5.0

2 release files

8.4.0

2 release files

8.3.0

2 release files

8.2.0

2 release files

8.1.0

2 release files

8.0.0

2 release files

7.6.0

2 release files

7.5.0

2 release files

7.4.0

2 release files

7.3.0

2 release files

7.2.0

2 release files

7.1.0

2 release files

7.0.0

2 release files

6.0.0

2 release files

5.0.0

2 release files

4.0.0

2 release files

3.5.0

2 release files

3.3.0

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.6.0

2 release files

This release

2.5.1 This release

2 release files

2.5

2 release files

2.4

2 release files

2.3

2 release files

2.1.1

3 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page