Skip to main content

Command line downloader for spotify tracks, playlists, albums and top artists tracks.

Project description

spotify-dlp

PyPI version PyPI downloads GitHub license

Command line downloader for spotify tracks, playlists, albums and top artists tracks. It works by taking the metadata out of these items using the Spotify API and searching them up on youtube. Then, it downloads the result by using yt-dlp.

 

Installation

  1. After having installed Python 3 with pip, you can install spotify-dlp using the following command:

    pip install spotify-dlp
    
  2. Then, login to Spotify developer console and click on "Create an App". Fill in details for name and description.

  3. Make a note of Client ID and Client Secret. These values need to be then set to the SPOTIFY_DLP_CLIENT_ID and SPOTIFY_DLP_CLIENT_SECRET environment variables respectively

    Alternatively, you can also include them in a .env file in the working directory, or even directly pass them as arguments.

    You can set environment variables by doing the following:

    Windows (run in cmd as administrator):

    setx SPOTIFY_DLP_CLIENT_ID "your_client_id"
    
    setx SPOTIFY_DLP_CLIENT_SECRET "your_client_secret"
    

    Linux (add to ~/.bashrc):

    export SPOTIFY_DLP_CLIENT_ID="your_client_id"
    export SPOTIFY_DLP_CLIENT_SECRET="your_client_secret"
    
  4. You can now use the script by running spotify-dlp in the command line. Also, ffmpeg is required if you wish to convert the m4a codec to another one using the -c argument.

 

Arguments

Command Example Description
"kon queso" The words to search up
or a link to a spotify album, artist, playlist or track.
-i --client-id "qwertyuiop" The Spotify Client ID*.
-s --client-secret "asdfghjkl" The Spotify Client Secret*.
-f --format "{name} - {authors} ({album})" The format of the downloaded tracks' names
(--help to show available fields).
-t --type "track" When searching up a query, the specified type of content.
-o --output "./album/" The output path of the downloaded tracks.
-c --codec "m4a" The audio codec of the downloaded tracks.
-y --yes Whether to skip the confirmation prompt.
-l --slice "2:6" The beginning and ending index of the list items to download
separated by a colon ":" (1-based).
Either one of those indexes can be omitted.
-v --verbose Whether to display verbose information.
--help Show the help message and exit.

*Required if not already found in the environment variables or in the working directory .env file.

 

Use Examples

spotify-dlp kon queso mf doom
spotify-dlp mm food -t album -o "%userprofile%\Desktop" -a mp3 -c
spotify-dlp https://open.spotify.com/album/1UcS2nqUhxrZjrBZ3tHk2N -i "your_client_id" -s "your_client_secret"

 

Screenshots

Downloading album

 

Changelog

This changelog only includes changes that are worth mentioning.

  • 2.0.0:
    - Basically, everything changed. Also added package to PyPI.
    • 2.0.1:
      - Fixed --verbose argument not working.
      - Made youtube search more accurate.
      - Better error handling.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spotify-dlp-2.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

spotify_dlp-2.0.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file spotify-dlp-2.0.1.tar.gz.

File metadata

  • Download URL: spotify-dlp-2.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for spotify-dlp-2.0.1.tar.gz
Algorithm Hash digest
SHA256 9db05f46d628d22159a412c9d21834edb9177c064f38fe4c313c5d63e50eb36d
MD5 b47d0254e3b6df5bfa1b0eb85a854211
BLAKE2b-256 a1cd30e81db67cdb1ed6c10601b868f35cde945514557179cc76fe9201862a23

See more details on using hashes here.

File details

Details for the file spotify_dlp-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: spotify_dlp-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for spotify_dlp-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9aff29e4dba3627aea287ab8def63562bbe90cefc774f9c30f1428b5776dbaf
MD5 1644fa1d517659c8a6de1bf1b6a75f75
BLAKE2b-256 0e0e0404d6ff5535e0bbe4e2e523f42bde8498694cd8bfec48f39f7099f4221f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page