Spotify Web Downloader
A Python CLI app for downloading songs and music videos directly from Spotify.
Discord Server: https://discord.gg/aBjMEZ9tnq
Features
- Download songs in AAC 128kbps or in AAC 256kbps with a premium account
- Download synced lyrics
- Download music videos with a premium account
- Highly configurable
Prerequisites
- Python 3.8 or higher
- A .wvd file
- A .wvd file contains the Widevine keys from a device and is required to decrypt the files. The easiest method of obtaining one is using KeyDive, which extracts it from an Android device. Detailed instructions can be found here: https://github.com/hyugogirubato/KeyDive.
- .wvd files extracted from emulated devices may not work.
- The cookies file of your Spotify browser session in Netscape format (free or premium)
- You can get your cookies by using one of the following extensions on your browser of choice at the Spotify website with your account signed in:
- Firefox: https://addons.mozilla.org/addon/export-cookies-txt
- Chromium based browsers: https://chrome.google.com/webstore/detail/gdocmgbfkjnnpapoeobnolbbkoibbcif
- You can get your cookies by using one of the following extensions on your browser of choice at the Spotify website with your account signed in:
- FFmpeg on your system PATH
- Older versions of FFmpeg may not work.
- Up to date binaries can be obtained from the links below:
Installation
- Install the package
spotify-web-downloaderusing pippip install spotify-web-downloader
- Place your cookies file and the .wvd file in the directory from which you will be running spotify-web-downloader and name it
cookies.txtanddevice.wvdrespectively.
Usage
spotify-web-downloader [OPTIONS] URLS...
Examples
- Download a song
spotify-web-downloader "https://open.spotify.com/track/18gqCQzqYb0zvurQPlRkpo"
- Download an album
spotify-web-downloader "https://open.spotify.com/album/0r8D5N674HbTXlR3zNxeU1"
Configuration
spotify-web-downloader can be configured using the command line arguments or the config file.
The config file is created automatically when you run spotify-web-downloader for the first time at ~/.spotify-web-downloader/config.json on Linux and %USERPROFILE%\.spotify-web-downloader\config.json on Windows.
Config file values can be overridden using command line arguments.
| Command line argument / Config file key | Description | Default value |
|---|---|---|
--wait-interval, -w / wait_interval |
Wait interval between downloads in seconds. | 10 |
--download-music-video / download_music_video |
Attempt to download music videos from songs (can lead to incorrect results). | false |
--force-premium, -f / force_premium |
Force to detect the account as premium. | false |
--save-cover, -s / save_cover |
Save cover as a separate file. | false |
--overwrite / overwrite |
Overwrite existing files. | false |
--read-urls-as-txt, -r / - |
Interpret URLs as paths to text files containing URLs. | false |
--save-playlist / save_playlist |
Save a M3U8 playlist file when downloading a playlist. | false |
--lrc-only, -l / lrc_only |
Download only the synced lyrics. | false |
--no-lrc / no_lrc |
Don't download the synced lyrics. | false |
--config-path / - |
Path to config file. | <home>/.spotify-web-downloader/config.json |
--log-level / log_level |
Log level. | INFO |
--print-exceptions / print_exceptions |
Print exceptions. | false |
--cookies-path, -c / cookies_path |
Path to .txt cookies file. | ./cookies.txt |
--output-path, -o / output_path |
Path to output directory. | ./Spotify |
--temp-path / temp_path |
Path to temporary directory. | ./temp |
--wvd-path / wvd_path |
Path to .wvd file. | ./device.wvd |
--ffmpeg-path / ffmpeg_path |
Path to FFmpeg binary. | ffmpeg |
--mp4box-path / mp4box_path |
Path to MP4Box binary. | MP4Box |
--mp4decrypt-path / mp4decrypt_path |
Path to mp4decrypt binary. | mp4decrypt |
--aria2c-path / aria2c_path |
Path to aria2c binary. | aria2c |
--nm3u8dlre-path / nm3u8dlre_path |
Path to N_m3u8DL-RE binary. | N_m3u8DL-RE |
--remux-mode / remux_mode |
Remux mode. | ffmpeg |
--template-folder-album / template_folder_album |
Template folder for tracks that are part of an album. | {album_artist}/{album} |
--template-folder-compilation / template_folder_compilation |
Template folder for tracks that are part of a compilation album. | Compilations/{album} |
--template-file-single-disc / template_file_single_disc |
Template file for the tracks that are part of a single-disc album. | {track:02d} {title} |
--template-file-multi-disc / template_file_multi_disc |
Template file for the tracks that are part of a multi-disc album. | {disc}-{track:02d} {title} |
--template-folder-no-album / template_folder_no_album |
Template folder for the tracks that are not part of an album. | {artist}/Unknown Album |
--template-file-no-album / template_file_no_album |
Template file for the tracks that are not part of an album. | {title} |
--template-file-playlist / template_file_playlist |
Template file for the M3U8 playlist. | Playlists/{playlist_artist}/{playlist_title} |
--date-tag-template / date_tag_template |
Date tag template. | %Y-%m-%dT%H:%M:%SZ |
--exclude-tags / exclude_tags |
Comma-separated tags to exclude. | null |
--truncate / truncate |
Maximum length of the file/folder names. | null |
--download-mode-song / download_mode_song |
Download mode for songs. | ytdlp |
--premium-quality, -p / premium_quality |
Download songs in premium quality. | false |
--download-mode-video / download_mode_video |
Download mode for videos. | ytdlp |
--no-config-file, -n / - |
Do not use a config file. | false |
Tag variables
The following variables can be used in the template folder/file and/or in the exclude_tags list:
albumalbum_artistartistcompilationcomposercopyrightcoverdiscdisc_totalisrclabellyricsmedia_typeplaylist_artistplaylist_titleplaylist_trackproducerratingrelease_daterelease_yeartitletracktrack_totalurl
Remux modes
The following remux modes are available:
ffmpegmp4box- Requires mp4decrypt
- Can be obtained from here: https://gpac.wp.imt.fr/downloads
Music videos quality
Music videos will be downloaded in the highest quality available in H.264/AAC, up to 1080p.
Download modes
The following modes are available for songs:
ytdlparia2c- Faster than
ytdlp - Can be obtained from here: https://github.com/aria2/aria2/releases
- Faster than
The following modes are available for videos:
ytdlpnm3u8dlre- Faster than
ytdlp - Can be obtained from here: https://github.com/nilaoda/N_m3u8DL-RE/releases
- Faster than
Metadata
Release files for spotify-web-downloader 1.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spotify_web_downloader-1.8.1.tar.gz | 20.4 kB | Without provenance | Details for spotify_web_downloader-1.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spotify_web_downloader-1.8.1-py3-none-any.whl | Python 3 | none | any | Details for spotify_web_downloader-1.8.1-py3-none-any.whl |
Total release size: 43.0 kB
Release files / spotify_web_downloader-1.8.1.tar.gz
| Download URL | spotify_web_downloader-1.8.1.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6956aa8184294837bd890deca1bd6b0c84dca2304341dce448f45b3eb8dca2eb
|
|
BLAKE2b-256 checksum How to use checksums |
d6ff9de81316a23e9a0e860b04e85351c6318b4ea4d3a670c6614662f71f1727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Release files / spotify_web_downloader-1.8.1-py3-none-any.whl
| Download URL | spotify_web_downloader-1.8.1-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddf7587768ede88d51f56749a7472ce22a2182e65546aa7a3b1b0f171fd8bb6a
|
|
BLAKE2b-256 checksum How to use checksums |
129beaf38249431bf71ec09b0a3d2333bf239eeafeb8d8a347c790f373c616c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Security for spotify-web-downloader 1.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.