spotify-downloader
Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
Top Related Projects
A feature-rich command-line audio/video downloader
Command-line program to download videos from YouTube.com and other video sites
yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
A curated list of awesome warez and piracy links
Quick Overview
spotDL/spotify-downloader is an open-source Python library and command-line tool that allows users to download music from Spotify. It can download songs, albums, and playlists by extracting metadata from Spotify and finding matching audio on YouTube.
Pros
- Easy to use with both command-line interface and Python API
- Supports downloading entire albums and playlists
- Automatically adds metadata and album art to downloaded files
- Cross-platform compatibility (Windows, macOS, Linux)
Cons
- Relies on YouTube as a source, which may have varying audio quality
- Potential legal concerns regarding copyright infringement
- May not always find exact matches for all songs
- Dependent on external services (Spotify and YouTube) which could change their APIs
Code Examples
- Downloading a single track:
from spotdl import Spotdl
spotdl = Spotdl(client_id="your_client_id", client_secret="your_client_secret")
song = spotdl.search(["https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b"])
spotdl.download_songs(song)
- Downloading an entire album:
from spotdl import Spotdl
spotdl = Spotdl(client_id="your_client_id", client_secret="your_client_secret")
songs = spotdl.search(["https://open.spotify.com/album/1DFixLWuPkv3KT3TnV35m3"])
spotdl.download_songs(songs)
- Searching and downloading a playlist:
from spotdl import Spotdl
spotdl = Spotdl(client_id="your_client_id", client_secret="your_client_secret")
songs = spotdl.search(["https://open.spotify.com/playlist/37i9dQZF1DX5Ejj0EkURtP"])
spotdl.download_songs(songs)
Getting Started
-
Install spotDL using pip:
pip install spotdl
-
Set up Spotify API credentials:
- Go to https://developer.spotify.com/dashboard/
- Create a new application to get your
client_id
andclient_secret
-
Use the library in your Python script:
from spotdl import Spotdl spotdl = Spotdl(client_id="your_client_id", client_secret="your_client_secret") songs = spotdl.search(["https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b"]) spotdl.download_songs(songs)
-
Alternatively, use the command-line interface:
spotdl download https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b
Competitor Comparisons
A feature-rich command-line audio/video downloader
Pros of yt-dlp
- Supports a wide range of video and audio platforms beyond YouTube
- More actively maintained with frequent updates and bug fixes
- Offers advanced features like throttling, rate limiting, and custom output templates
Cons of yt-dlp
- Lacks specific Spotify integration for playlist and album downloads
- May require more configuration for optimal music downloads
- Not specifically designed for music, which can result in inconsistent metadata
Code Comparison
spotify-downloader:
from spotdl import Spotdl
spotdl = Spotdl(client_id, client_secret)
songs = spotdl.search(["https://open.spotify.com/track/..."])
spotdl.download_songs(songs)
yt-dlp:
import yt_dlp
ydl_opts = {'format': 'bestaudio/best', 'postprocessors': [{
'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3',
'preferredquality': '192',
}]}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=...'])
spotify-downloader is specifically designed for downloading Spotify tracks, albums, and playlists, with built-in search functionality and metadata handling. yt-dlp, on the other hand, is a more versatile tool for downloading from various platforms, requiring additional configuration for optimal music downloads but offering more flexibility and features for general media downloading.
Command-line program to download videos from YouTube.com and other video sites
Pros of youtube-dl
- Supports a wide range of video platforms beyond YouTube
- More mature project with a larger community and extensive documentation
- Offers advanced features like playlist downloading and format selection
Cons of youtube-dl
- Primarily focused on video content, less optimized for music
- Requires additional steps to extract audio from video files
- More complex command-line interface for basic music downloading tasks
Code Comparison
spotify-downloader:
from spotdl import Spotdl
spotdl = Spotdl(client_id="your_client_id", client_secret="your_client_secret")
songs = spotdl.search(["song_name"])
spotdl.download_songs(songs)
youtube-dl:
import youtube_dl
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=VIDEO_ID'])
spotify-downloader is specifically designed for downloading music from Spotify, offering a more streamlined experience for this use case. It provides direct integration with Spotify's API and simplifies the process of searching and downloading songs.
youtube-dl, on the other hand, is a more versatile tool that supports various video platforms. While it can be used for music downloading, it requires additional configuration and post-processing to extract audio from video files.
yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
Pros of yewtube
- Supports a wider range of content sources (YouTube, SoundCloud, etc.)
- Offers a text-based user interface for easier navigation
- Allows for playlist creation and management within the application
Cons of yewtube
- Limited to audio-only downloads
- Requires more manual input for searching and selecting content
- Less focused on Spotify integration and metadata handling
Code Comparison
spotify-downloader:
from spotdl import Spotdl
spotdl = Spotdl(client_id="your-client-id", client_secret="your-client-secret")
songs = spotdl.search(["song1", "song2"])
spotdl.download_songs(songs)
yewtube:
from mps_youtube import main
main.main()
# User interacts with the text-based interface
# to search, play, and download content
The code comparison shows that spotify-downloader offers a more programmatic approach, allowing for easier automation and integration into other projects. yewtube, on the other hand, is designed for interactive use through its text-based interface.
spotify-downloader is more specialized for Spotify content, providing better handling of Spotify-specific features and metadata. yewtube offers a broader range of content sources but may require more manual input for searching and downloading specific tracks.
A curated list of awesome warez and piracy links
Pros of awesome-piracy
- Comprehensive resource covering a wide range of piracy-related topics and tools
- Regularly updated with new information and links
- Provides a curated list of tools, websites, and resources for various media types
Cons of awesome-piracy
- Not focused on a specific functionality like music downloading
- Requires users to navigate through multiple resources to find desired content
- May include outdated or non-functional links due to the nature of piracy-related content
Code comparison
As awesome-piracy is primarily a curated list of resources and not a functional tool, there isn't a direct code comparison with spotify-downloader. However, spotify-downloader provides a Python-based solution for downloading music:
# spotify-downloader example
from spotdl import Spotdl
spotdl = Spotdl(client_id="your_client_id", client_secret="your_client_secret")
songs = spotdl.search(["song_name"])
spotdl.download_songs(songs)
awesome-piracy, on the other hand, might include links to various music downloading tools and resources, but doesn't provide a specific code implementation.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
spotDL v4
spotDL finds songs from Spotify playlists on YouTube and downloads them - along with album art, lyrics and metadata.
spotDL: The fastest, easiest and most accurate command-line music downloader.
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 spotdl
On some systems you might have to change
pip
topip3
.
Other options
-
Prebuilt executable
- You can download the latest version from the Releases Tab
-
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.
-
Docker
-
Build image:
docker build -t spotdl .
-
Launch container with spotDL parameters (see section below). You need to create mapped volume to access song files
docker run --rm -v $(pwd):/music spotdl download [trackUrl]
-
-
Build from source
git clone https://github.com/spotDL/spotify-downloader && cd spotify-downloader pip install poetry poetry install poetry run python3 scripts/build.py
An 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 ffmpeg
or use your distro's package manager
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] QUERY
There 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 single songs. -
url
: Get direct download link 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}.spotdl
This create 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, and help accelerate
Donate
help support the development and maintenance of the software â¤ï¸
License
This project is Licensed under the MIT License.
Top Related Projects
A feature-rich command-line audio/video downloader
Command-line program to download videos from YouTube.com and other video sites
yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
A curated list of awesome warez and piracy links
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot