repository

SpotDL

Download Entire Spotify Playlists To Your Local Machine

version 1.0.1 · BSD-2-CLAUSE · 2026-12-03 · releases

download 1.0.1 4.6 KB · sha256 1d1f99ab663608a855fca38bb106679366b763e50e086469ece486d5148b6fc3

Spotify Playlist Downloader

A Python wrapper around SpotDL that reads Spotify playlist, album, or track links and downloads matching audio from YouTube Music. It uses Spotify metadata to tag downloaded files.

Important: This does not download Spotify's original audio or bypass Spotify DRM. Matches and available audio quality depend on the source. Use it only for music you have permission to download.

Features

  • Downloads a Spotify playlist, album, or individual track by URL.
  • Saves files as Song Name.m4a (title-only filenames).
  • Uses SpotDL to embed supported metadata, including title, artist, album, release information, track number, and album artwork when available.
  • Requests M4A output without a forced bitrate conversion.
  • Scans for existing songs and attempts to refresh metadata.

Limitations: Two tracks with the same title may collide; the current script does not guarantee collision-safe filenames. --restrict strict can simplify filenames beyond removing invalid characters. Source tracks may be incorrectly matched, and M4A output is not necessarily lossless or compatible with every player. The script does not perform audio restoration or normalization.

Files

Save the companion Python script as spotify_downloader.py in a convenient folder. The instructions below assume that name. The README does not include the Python script itself.

Windows

  1. Install Python 3 from python.org and enable Add Python to PATH during installation (or use the Python launcher py).
  2. Open PowerShell and check:
   py --version
  1. Install SpotDL and its dependencies:
   py -m pip install --upgrade spotdl
   py -m spotdl --download-ffmpeg
   py -m spotdl --download-deno
  1. Navigate to the directory containing the script and run it:
   cd "$HOME\Downloads"
   py .\spotify_downloader.py
  1. Paste your Spotify playlist, album, or track URL when prompted. Press Enter to accept the default destination, Music\Spotify Downloads, or type a custom path.

If py is not found, try python in its place. If pip reports an externally managed environment or permissions issue, use a virtual environment as described below.

Linux

  1. Install Python 3, pip, FFmpeg, and Deno (if available from your distribution's packages). Example for Debian/Ubuntu:
   sudo apt update
   sudo apt install python3 python3-venv python3-pip ffmpeg
  1. Create a virtual environment and install SpotDL:
   python3 -m venv ~/.venvs/spotdl
   ~/.venvs/spotdl/bin/python -m pip install --upgrade pip spotdl
   ~/.venvs/spotdl/bin/python -m spotdl --download-deno

If the Deno helper command is unsupported by your installed SpotDL version, consult its current installation documentation. You may instead install Deno from its official distribution instructions.

  1. Run the script:
   ~/.venvs/spotdl/bin/python spotify_downloader.py
  1. Paste the Spotify URL and select a destination. The default is ~/Music/Spotify Downloads.

Other distributions: Use your package manager to install Python 3 and FFmpeg; then follow the same virtual-environment commands.

FreeBSD (including GhostBSD)

  1. Install Python, FFmpeg, and pip support:
   sudo pkg update
   sudo pkg install python3 py311-pip ffmpeg

Package names vary by FreeBSD release. If py311-pip is unavailable or your installed python3 is a different version, find the matching pip package with pkg search 'py*-pip', or use python3 -m ensurepip where supported. Verify with python3 -m pip --version.

  1. Create a virtual environment:
   python3 -m venv "$HOME/.venvs/spotdl"
   "$HOME/.venvs/spotdl/bin/python" -m pip install --upgrade pip spotdl
  1. Confirm FFmpeg is installed:
   ffmpeg -version
  1. SpotDL's YouTube backend may require Deno. If deno is available through your package repository, install it with sudo pkg install deno. Otherwise consult the current SpotDL and Deno documentation for supported FreeBSD installation options. Do not assume spotdl --download-deno works on every FreeBSD architecture/version.

  2. Run:

   "$HOME/.venvs/spotdl/bin/python" spotify_downloader.py

The default output is ~/Music/Spotify Downloads.

How to get a Spotify playlist URL

In Spotify, open the playlist, select Share, and choose Copy link to playlist. Paste that link into the program. The script also accepts Spotify album and individual track URLs.

Example session

SPOTIFY MUSIC LIBRARY DOWNLOADER
====================================

Spotify playlist URL: https://open.spotify.com/playlist/EXAMPLEID
Download directory [/home/user/Music/Spotify Downloads]:

Configuration:
Format: M4A
Filename: Song Name.m4a
Metadata: Spotify
Album art: Embedded
Duplicates: Existing files checked
Destination: /home/user/Music/Spotify Downloads

EXAMPLEID is a placeholder; use a real Spotify link.

Check metadata and cover art

Use a music player or tag editor (for example, MusicBrainz Picard, Kid3, or Mp3tag) to inspect the resulting files. You can also inspect tags with FFprobe:

ffprobe -v error -show_entries format_tags -of default=noprint_wrappers=1 "Song Name.m4a"

Cover art is embedded only when SpotDL successfully retrieves it. SpotDL's metadata support is not a guarantee that every field exists for every track.

Troubleshooting

ProblemWhat to try
No module named spotdlInstall SpotDL using the same Python interpreter that runs the script.
ffmpeg not foundInstall FFmpeg and ensure ffmpeg is on your PATH.
YouTube extraction errorsUpdate SpotDL and its dependencies; check whether Deno is required by your installed version.
Some songs are missingCheck the downloader's error output; tracks can be unavailable or incorrectly matched.
Cover art or artist tags are missingInspect with a tag editor and verify that Spotify metadata was available.
Same-title songs overwrite one anotherUse a unique filename template (e.g. {artists} - {title}.{output-ext}) or add a collision-safe renaming step.
M4A won't play on an older deviceConfirm the actual codec with ffprobe; re-encode only if needed for device compatibility.
--scan-for-songs or other flag is rejectedRun python -m spotdl download --help; CLI flags may change between SpotDL versions.

Updating

Use the same Python environment as installation:

python -m pip install --upgrade spotdl

On Windows, py -m pip install --upgrade spotdl is usually appropriate. On Linux and FreeBSD, use the Python executable inside ~/.venvs/spotdl.

Notes on audio quality

  • The --format m4a --bitrate disable options avoid requesting a specific bitrate, but do not guarantee that no conversion happens.
  • Renaming or converting lossy audio to FLAC does not make it lossless.
  • Source quality and licensing are independent of Spotify's playlist metadata.

References