File: README.md
Read the documentation on ReadTheDocs!
Installation
Refer to our Installation Guide for more details.
Python (Recommended Method)
spotDL can be installed by running
pip install spotdl.To update spotDL run
pip install --upgrade spotdlOn some systems you might have to change
piptopip3.Other options
Prebuilt executable
- You can download the latest version from the
Releases Tab
- You can download the latest version from the
On Termux
curl -L https://raw.githubusercontent.com/spotDL/spotify-downloader/master/scripts/termux.sh | sh
Arch
- There is an Arch User Repository (AUR) package for
spotDL.
- There is an Arch User Repository (AUR) package for
Docker
Build image:
bashdocker build -t spotdl .Launch container with spotDL parameters (see section below). You need to create mapped
volume to access song filesbashdocker run --rm -v $(pwd):/music spotdl download [trackUrl]For Docker Compose and permission-managed Docker downloads, see
the Docker section in/docs/index.md.Build from source
bashgit clone https://github.com/spotDL/spotify-downloader && cd spotify-downloader pip install uv uv sync uv run scripts/build.pyAn executable is created in
spotify-downloader/dist/.
Installing FFmpeg
FFmpeg is required for spotDL. If using FFmpeg only for spotDL, you can simply install FFmpeg to your spotDL installation directory:spotdl --download-ffmpeg
We recommend the above option, but if you want to install FFmpeg system-wide,
follow these instructions
- Windows Tutorial
- OSX -
brew install ffmpeg - Linux -
sudo apt install ffmpegor use your distro's package manager
Installing Deno
We strongly recommend installing Deno. spotDL uses yt-dlp for YouTube downloads, and some
videos require Deno to download successfully. Without Deno, spotDL may fail to download some
songs, including videos marked as "made for kids".
If using Deno only for spotDL, install Deno to your spotDL directory:spotdl --download-deno
If you want to install Deno system-wide instead, follow the
official Deno installation guide.
Usage
Using SpotDL without options:
spotdl [urls]You can run spotDL as a package if running it as a script doesn't work:
python -m spotdl [urls]General usage:
spotdl [operation] [options] QUERYThere are different operations spotDL can perform. The default is download, which simply downloads the songs from YouTube and embeds metadata.
The query for spotDL is usually a list of Spotify URLs, but for some operations like sync, only a single link or file is required.
For a list of all options use spotdl -h
Supported operations
save: Saves only the metadata from Spotify without downloading anything.- Usage:
spotdl save [query] --save-file {filename}.spotdl
- Usage:
web: Starts a web interface instead of using the command line. However, it has limited features and only supports downloading individual songs.url: Get user-friendly URL for each song from the query.- Usage:
spotdl url [query]
- Usage:
sync: Updates directories. Compares the directory with the current state of the playlist. Newly added songs will be downloaded and removed songs will be deleted. No other songs will be downloaded and no other files will be deleted.Usage:
spotdl sync [query] --save-file {filename}.spotdlThis creates a new sync file. To update the directory in the future, use:
spotdl sync {filename}.spotdl
meta: Updates metadata for the provided song files.
Music Sourcing and Audio Quality
spotDL uses YouTube as a source for music downloads. This method is used to avoid any issues related to downloading music from Spotify.
Note
Users are responsible for their actions and potential legal consequences. We do not support unauthorized downloading of copyrighted material and take no responsibility for user actions.
Audio Quality
spotDL downloads music from YouTube and is designed to always download the highest possible bitrate; which is 128 kbps for regular users and 256 kbps for YouTube Music premium users.
Check the Audio Formats page for more info.
Contributing
Interested in contributing? Check out our CONTRIBUTING.md to find
resources around contributing along with a guide on how to set up a development environment.
Join our amazing community as a code contributor
License
This project is Licensed under the MIT License.
File: docs/CODE_OF_CONDUCT.md
Contributor Covenant Code of Conduct
Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a
harassment-free experience for everyone, regardless of age, body size, visible or invisible
disability, ethnicity, sex characteristics, gender identity and expression, level of
experience, education, socio-economic status, nationality, personal appearance, race, religion,
or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse,
inclusive, and healthy community.
Our Standards
Examples of behavior that contributes to a positive environment for our community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from
the experience - Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their
explicit permission - Other conduct which could reasonably be considered inappropriate in a professional setting
Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable
behavior and will take appropriate and fair corrective action in response to any behavior that
they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of
Conduct, and will communicate reasons for moderation decisions when appropriate.
Scope
This Code of Conduct applies within all community spaces, and also applies when an individual
is officially representing the community in public spaces. Examples of representing our
community include using an official e-mail address, posting via an official social media
account, or acting as an appointed representative at an online or offline event.
Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the
community leaders responsible for enforcement at [email protected]. All complaints
will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any
incident.
Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences
for any action they deem in violation of this Code of Conduct:
1. Correction
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or
unwelcome in the community.
Consequence: A private, written warning from community leaders, providing clarity around
the nature of the violation and an explanation of why the behavior was inappropriate. A public
apology may be requested.
2. Warning
Community Impact: A violation through a single incident or series of actions.
Consequence: A warning with consequences for continued behavior. No interaction with the
people involved, including unsolicited interaction with those enforcing the Code of Conduct,
for a specified period of time. This includes avoiding interactions in community spaces as well
as external channels like social media. Violating these terms may lead to a temporary or
permanent ban.
3. Temporary Ban
Community Impact: A serious violation of community standards, including sustained
inappropriate behavior.
Consequence: A temporary ban from any sort of interaction or public communication with the
community for a specified period of time. No public or private interaction with the people
involved, including unsolicited interaction with those enforcing the Code of Conduct, is
allowed during this period. Violating these terms may lead to a permanent ban.
4. Permanent Ban
Community Impact: Demonstrating a pattern of violation of community standards, including
sustained inappropriate behavior, harassment of an individual, or aggression toward or
disparagement of classes of individuals.
Consequence: A permanent ban from any sort of public interaction within the community.
Attribution
This Code of Conduct is adapted from the Contributor Covenant, version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by
Mozilla's code of conduct enforcement ladder.
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
File: docs/CONTRIBUTING.md
Contributing to spotdl
First off, thanks for taking the time to contribute! โค๏ธ
All types of contributions are encouraged and valued. See the
Table of Contents for different ways to help and details about how this
project handles them. Please make sure to read the relevant section before making your
contribution. It will make it a lot easier for us maintainers and smooth out the experience for
everyone involved. The community looks forward to your contributions. ๐
And if you like the project, but just don't have time to contribute, that's fine. There are
other easy ways to support the project and show your appreciation, which we would also be
very happy about:
- Star the project
- Tweet about it
- Refer this project in your project's readme
- Mention the project at local meetups and tell your friends/colleagues
Table of Contents
- I Have a Question
- I Want To Contribute
- Reporting Bugs
- Suggesting Enhancements
- Linting, Formatting and Type-checking
- Python Documentation
- Overview of the Project Structure
- Join The Project Team
I Have a Question
If you want to ask a question, we assume that you have read the available
Documentation.
Before you ask a question, it is best to search for existing
Issues that might help you. In case you
have found a suitable issue and still need clarification, you can write your question in this
issue. It is also advisable to search the internet for answers first.
If you then still feel the need to ask a question and need clarification, we recommend the
following:
- Open an Issue.
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (Node.js, npm, etc.), depending on what seems relevant.
We will then take care of the issue as soon as possible.
I Want To Contribute
Legal Notice
When contributing to this project, you must agree that you have authored 100% of the content,
that you have the necessary rights to the content and that the content you contribute may be
provided under the project license.
AUTOMATED CONTRIBUTIONS (AI / LLM) POLICY
AI Use
- It is in everyone's best interest to not submit issues, pull requests or feature requests that are AI-generated.
- All such requests will be closed and submitters will be blocked from the repository.
You must...
- Be able to understand and respond to questions relating to the issue or the fix you provide.
- You can use an AI tool for proofreading, translating or understanding the issue's content.
- You cannot use AI tools to generate the issue text, or the issue itself.
Pull Requests
- You should be able to explain every part of the code you have written/modified in your PR.
- If you do not understand your PR, do not submit it. You cannot use an AI tool to generate code for you.
The rationale behind this policy is that automated contributions are a waste of the maintainers' time. Humans spend their time and brainpower reviewing every submission. Issues or pull requests generated by automation tools create an imbalance of effort between the submitter and the reviewer. Nobody learns anything when a maintainer reviews code written by an LLM.
Additionally, such AI-generated content impedes legitimate issues and feature requests that would add more value to the project.
Reporting Bugs
Before Submitting a Bug Report
A good bug report shouldn't leave others needing to chase you up for more information.
Therefore, we ask you to investigate carefully, collect information and describe the issue in
detail in your report. Please complete the following steps in advance to help us fix any
potential bug as fast as possible.
- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible
environment components/versions (Make sure that you have read the
documentation. If you are looking for
support, you might want to check this section). - To see if other users have experienced (and potentially already solved) the same issue you
are having, check if there is not already a bug report existing for your bug or error in the
bug tracker. - Also make sure to search the internet (including Stack Overflow) to see if users outside of
the GitHub community have discussed the issue. - Collect information about the bug:
- Stack trace (Traceback)
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on
what seems relevant. - Possibly your input and the output
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?
How Do I Submit a Good Bug Report?
You must never report security related issues, vulnerabilities or bugs to the issue tracker,
or elsewhere in public. Instead sensitive bugs must be sent by Discord to Silverarmor (spotDL Discord Owner).
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
- Open an Issue. (Since we can't be
sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not
to label the issue.) - Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the reproduction steps that someone
else can follow to recreate the issue on their own. This usually includes your code. For good
bug reports you should isolate the problem and create a reduced test case. - Provide the information you collected in the previous section.
Once it's filed:
- The project team will label the issue accordingly.
- A team member will try to reproduce the issue with your provided steps. If there are no
reproduction steps or no obvious way to reproduce the issue, the team will ask you for those
steps and mark the issue asneeds-repro. Bugs with theneeds-reprotag will not be
addressed until they are reproduced. - If the team is able to reproduce the issue, it will be marked
needs-fix, as well as
possibly other tags (such ascritical), and the issue will be left to be
implemented by someone.
Suggesting Enhancements
This section guides you through submitting an enhancement suggestion for spotdl, including
completely new features and minor improvements to existing functionality. Following these
guidelines will help maintainers and the community to understand your suggestion and find
related suggestions.
Before Submitting an Enhancement
- Make sure that you are using the latest version.
- Read the documentation carefully and find
out if the functionality is already covered, maybe by an individual configuration. - Perform a search to see if the
enhancement has already been suggested. If it has, add a comment to the existing issue
instead of opening a new one. - Find out whether your idea fits with the scope and aims of the project. It's up to you to
make a strong case to convince the project's developers of the merits of this feature. Keep
in mind that we want features that will be useful to the majority of our users and not just a
small subset. If you're just targeting a minority of users, consider writing an add-on/plugin
library.
How Do I Submit a Good Enhancement Suggestion?
Enhancement suggestions are tracked as
GitHub issues.
Use a clear and descriptive title for the issue to identify the suggestion.
Provide a step-by-step description of the suggested enhancement in as many details as
possible.Describe the current behavior and explain which behavior you expected to see instead
and why. At this point you can also tell which alternatives do not work for you.You may want to include screenshots and animated GIFs which help you demonstrate the
steps or point out the part which the suggestion is related to. You can use
this tool to record GIFs on macOS and Windows, and
this tool or
this tool on Linux.Explain why this enhancement would be useful to most spotdl users. You may also want to
point out the other projects that solved it better and which could serve as inspiration.
Developing
Fork the repository on Github and then clone it.
git clone [your username]/spotify-downloader
cd spotify-downloaderInstall uv
bashpip install uvInstall spotDL in-place
bashuv syncActivate virtual environment
=== "macOS and Linux"
```bash
source .venv/bin/activate
```=== "Windows"
```console
.venv\Scripts\activate
```OR you can prefix all commands with
uv runbashuv run spotdl -h
Linting, Formatting and Type-checking
We use
pylintfor linting and expect a score above9bashpylint --fail-under 10 --limit-inference-results 0 --disable=R0917 ./spotdlWe use
blackfor code formattingbashblack ./spotdlWe use
mypyfor type-checking and expect no errors at allTo install type-stubs the first time around
bashmypy --ignore-missing-imports --follow-imports silent --install-types --non-interactive ./spotdlbashmypy ./spotdlWe use
isortfor sorting importsbashisort --check --diff ./spotdl
Python Documentation
Any submitted code is expected to have accompanying documentation
mkdocs: generating documentation
We generate our documentation with
mkdocsGenerate docs with
bashmkdocs build --strictView docs in real-time while editing with
bashmkdocs serve
DocString Formats
For functions
textone-liner about function's purpose ### Args (optional) - arg_name: description ### Returns (optional) - return value description ### Errors (only if there are known unhandled Errors/thrown Errors) - known errors ### Notes (optional) - notes if anyFor Classes
textone-liner about class purpose ### Attributes - attribute: description ### Notes (optional) - notes if anyFor modules/package
__init__textAt most 3 lines about module/package purpose Optional usage example for module/package, preferably showcasing most commonly used functionality
Notes about docstrings
DocStrings are Inherited
textclass A: def test(self): """Docstring for A.""" pass class B(A): def test(self): pass
Overview of the Project Structure
| sub-package | purpose |
|---|---|
utils |
Contains commonly used functions |
types |
Custom data types used in the spotdl project |
providers |
Different Providers to obtain info (like song details) from |
download |
Download manager |
console |
Different user-facing operations like download, preload and web-ui |
__init__ |
Contains spotdl class that simplifies the download process |
Join The Project Team
Attribution
This guide is based on the contributing-gen.
Make your own!
File: docs/usage.md
spotDL usage examples
Downloading
??? Song info
To download a song, run
```bash
spotdl download [trackUrl]
```
example:
```bash
spotdl download https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b
```??? Album info
To download an album, run
```bash
spotdl download [albumUrl]
```
example:
```bash
spotdl download https://open.spotify.com/album/4yP0hdKOZPNshxUOjY0cZj
```??? Playlist info
To download a playlist, run
```bash
spotdl download [playlistUrl]
```
example:
```bash
spotdl download https://open.spotify.com/playlist/37i9dQZF1E8UXBoz02kGID
```??? Artist info
To download all songs from an artist run
```bash
spotdl download [artistUrl]
```
example:
```bash
spotdl download https://open.spotify.com/artist/1Xyo4u8uXC1ZmMpatF05PJ
```??? Search info
To search for and download a song, run, with quotation marks
```bash
spotdl download '[songQuery]'
```
example:
```bash
spotdl download 'The Weeknd - Blinding Lights'
```??? info "YouTube link with Spotify metadata"
To download a YouTube video with metadata from Spotify, run
> Note that the quotes " are required
```bash
spotdl download "YouTubeURL|SpotifyURL"
```
example:
```bash
spotdl download "https://www.youtube.com/watch?v=XXYlFuWEuKI|https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b?si=b5c0790edc8f4904"
```??? info "Liked songs"
To download liked Spotify songs, run
> --user-auth is required
```bash
spotdl download saved --user-auth
```??? info "All user playlists"
To download all user playlists, run
> --user-auth is required
```bash
spotdl download all-user-playlists --user-auth
```??? info "All user saved albums"
To download all user saved albums, run
> --user-auth is required
```bash
spotdl download all-user-saved-albums --user-auth
```You can queue up multiple download tasks by separating the arguments with spaces
spotdl download [songQuery1] [albumUrl] [songQuery2] ... (order does not matter)example:
spotdl download 'The Weeknd - Blinding Lights' https://open.spotify.com/playlist/37i9dQZF1E8UXBoz02kGID ...Audio Formats and Quality
Files are downloaded in MP3 format for the best compatibility across different platforms/players, but spotDL also supports other output formats like M4A and OPUS.
Note: spotDL never downloads songs in a bitrate higher than 128kbps, except for those with YTMusic Premium, where 256 kbps is available for M4A format.
Note that using the --bitrate flag will convert the file to the specified bitrate, so it may result in larger file sizes with no significant change in quality. If you prefer smaller file sizes, consider using the default bitrate or a lower value.
Converting files might not be ideal for some users who prefer the files in their original quality.
Alternatively, you can use the --bitrate disable option to skip the conversion step for certain file formats such as M4A/OPUS.
YouTube Music Premium
YouTube Music Premium users can use their account to download songs with a higher bitrate (256kbps).
To download music in higher quality follow the steps below:
Change quality in YouTube Music settings to highest possible.
Get cookies.txt for https://music.youtube.com.
You can use Get cookies.txt extension or cookies.txt for this. More info here
- Add
--cookie-file cookies.txtoption to your spotDL command line options
Replace cookies.txt with the actual name of your cookies file
- Change the audio format to either M4A or OPUS to get the raw HQ file
Note
To get the best audio possible you should use M4A/OPUS audio format
with--bitrate disable
Syncing
Sync function for the console. Keeps local files up to date with playlists/albums/etc.
This will download new songs and remove the ones that are no longer present in the playlists/albums/etc.
??? info "Initialize Synchronization"
To create the sync file, run
```bash
spotdl sync [query] --save-file [fileName]
```
Example:
```bash
spotdl sync https://open.spotify.com/playlist/37i9dQZF1E8UXBoz02kGID --save-file "the-weeknd.sync.spotdl"
```
> Note: The sync file has to end with .spotdl??? info "Syncing"
To sync the songs, run
```bash
spotdl sync [fileName]
```
Example:
```bash
spotdl sync "the-weeknd.sync.spotdl"
```
You can append `--sync-without-deleting` if you don't want to remove songs that are no longer present
Example:
```bash
spotdl sync "the-weeknd.sync.spotdl" --sync-without-deleting
```Saving
Saves the songs metadata to a file for further use.
spotdl save [query] --save-file [fileName]example:
spotdl save 'The Weeknd - Blinding Lights' --save-file 'the-weeknd.spotdl'??? info "Preloading"
Preload the download URL to speed up the download process.
```bash
spotdl save [query] --save-file [fileName] --preload
```
example:
```bash
spotdl save 'The Weeknd - Blinding Lights' --save-file 'the-weeknd.spotdl' --preload
```Web UI (User Interface)
To start the web UI, run
spotdl webDownload Location
By default, the web UI downloads files to a special directory, to overwrite this behavior
add option --web-use-output-dir, which will make output directory follow --output
Config file
Config file location
The config file is located at C:\Users\user\.spotdl\config.json
or ~/.config/spotdl/config.json under Linux
Note: Prior to v4.4.3 the default Linux location was
~/.spotdl/config.jsonwhich will be used if the new directory doesn't exist.
Generate a config file
To generate a config file, run
spotdl --generate-configNote: This will overwrite the existing config file.
Loading config
The config file gets loaded automatically if it already exists, or if you've passed the --config flag.
If you don't want the config to load automatically, change the load_config option in the config file to false
{
"load_config": false
}Default config
/* Detailed source-code truncated for AI context efficiency. */`output` variables
The output key supports several variables:
| Variable | Explanation | Example |
|---|---|---|
{title} |
Song title | Dark Horse |
{artists} |
Song artists | Katy Perry, Juicy J |
{artist} |
Primary artist | Katy Perry |
{album} |
Album name | PRISM |
{album-artist} |
Primary artist of the album | Katy Perry |
{genre} |
Genre | dance pop |
{disc-number} |
Useful for multi-disc releases | 1 |
{disc-count} |
Total number of discs in the album | 1 |
{duration} |
Duration of the song in seconds | 215.672 |
{year} |
Year of release | 2013 |
{original-date} |
Date of original release | 2013-01-01 |
{track-number} |
Track number in the album | 06 |
{tracks-count} |
Total number of tracks in the album | 13 |
{isrc} |
International Standard Recording Code | USUM71311296 |
{track-id} |
Spotify song ID | 4jbmgIyjGoXjY01XxatOx6 |
{publisher} |
Record label | Capitol Records (CAP) |
{list-length} |
Number of items in a playlist | 10 |
{list-position} |
Position of the song in a playlist | 1 |
{list-name} |
Name of the playlist | Saved |
{output-ext} |
File extension | mp3 |
CLI (Command Line Interface)
Command line options
/* Detailed source-code truncated for AI context efficiency. */