Skip to main content

spoti-dl

Downloads Downloads

Introduction

spoti-dl(I had a better name but that was already taken on PyPi), is a song downloader app that accepts Spotify links, fetches songs and and their albums' information from Spotify, downloads the song from Youtube. The metadata is then written onto the downloaded song file, including the album art cover.

It supports downloading songs, albums and playlists as podcast episodes cannot be reliably downloaded through Youtube.

Version 2.0.0 Update

The version 2.0.0 update introduces several improvements. I've shifted the app to be predominantly Rust-based, all core functionality is now written in Rust, which should result in about 20-25% performance improvement directly. I have written a blog post on the same..

Albums and playlists are now downloaded in parallel, with 5 songs being downloaded in parallel by default. This has allowed for massive speedups - a 19-song album that earlier took about 115 seconds to download now took me roughly 25 seconds, that's more than a 4.5x speedup. You can download faster if you increase the number of parallel downloads, by setting the -p flag. This fixes a big issue with the app which was the unreasonable download times for albums and playlists, which can easily have 500 or even 1000 songs.

I have also cleaned up the error messages, added error-logging to a file (~/.spotidl.log), color coded output messages and made several other minor improvements. All in all, the app should feel much better to use now :)

The main reason to use FFI with Rust was mostly just to code in Rust, and also get some extra performance out of the application. I have been enjoying Rust a lot lately and Python has always been nice to work with too.

Setup

Run pip install spoti-dl to install the app first and foremost.

spoti-dl needs two things to work: FFmpeg and a Spotify developer account.

Steps to make a Spotify developer account:

  1. Go to Spotify Dev Dashboard
  2. Login with your credentials and click on "create an app".
  3. Enter any name of choice, app description, tick the checkbox and proceed.
  4. Now you have access to your client ID. Click on "Show client secret" to get your client secret.
  5. From here, click on "edit settings" and in the "redirect URIs" section add any localhost URL. I personally use http://localhost:8080/callback

Finally, define these three environment variables:

SPOTIPY_CLIENT_ID
SPOTIPY_CLIENT_SECRET
SPOTIPY_REDIRECT_URI

Also note that the first time you run the app you might get a popup window in your browser asking to integrate your account to the app you just created in the Spotify app dashboard. Accept and close the window. The window will automatically close if you've already granted access to the app in the past.

Usage

Note: Please try updating yt-dlp through pip if encountering random download failures.

spoti-dl <spotify URL or URI> 

as an example, running either of the commands would download Rick Astley's 'Never Gonna Give You Up':

spoti-dl https://open.spotify.com/track/4PTG3Z6ehGkBFwjybzWkR8
spoti-dl spotify:track:4PTG3Z6ehGkBFwjybzWkR8

The following audio formats are supported:

  • mp3
  • flac
  • m4a
  • opus (default)

The following bitrates are supported:

  • best (default)
  • 320kbps
  • 256kbps
  • 192kbps (slightly better than Spotify's 'high' audio setting, this is the bare minimum in my opinion to have a good listening experience)
  • 96kbps
  • 32kbps
  • worst

Again, the following link types are supported:

  • song,
  • album, and
  • playlist links

Note: File names (audio files or folder names (eg., playlist's directory name)) are changed to ensure compatibility with the operating systems since many characters like '?' or the '/' are illegal when making files/folders in certain systems and are removed during the downloads.

Flags

Flag Long Flag Usage
-h --help shows all the argument flags and their details
-d --dir the save directory to use while downloading
-c --codec the codec to use for downloads
-b --bitrate set the bitrate to use for downloads
-t --track-number prepend downloaded song names with their track order number
-p --parallel-downloads maximum number of parallel song downloads
-v --version displays the current app version

TODO

  • add tests

Release files for spoti-dl 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for spoti-dl 2.1.2
File Interpreter ABI Platform
spoti_dl-2.1.2-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
spoti_dl-2.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
spoti_dl-2.1.2-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details

Total release size: 17.7 MB

Release files / spoti_dl-2.1.2-cp38-abi3-win_amd64.whl

Download URL spoti_dl-2.1.2-cp38-abi3-win_amd64.whl
Size 2.9 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9d3044bd5d9959c2b9db00e84aafa80518913c75d497df0d4962bee630fdd2e0
BLAKE2b-256 checksum
How to use checksums
62ae6845492f7848de053dc617a7bd600b4996b49fd63cfe3f66dcfb48cc478d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / spoti_dl-2.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL spoti_dl-2.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 11.6 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b24115fb1e39e07655c535b7802562ea76ba28fec9575090ea25caa2394b28f2
BLAKE2b-256 checksum
How to use checksums
d9a103912201030409998b3b1cf8436a3dedcfd87d410de851ad0b27267c2096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / spoti_dl-2.1.2-cp38-abi3-macosx_11_0_arm64.whl

Download URL spoti_dl-2.1.2-cp38-abi3-macosx_11_0_arm64.whl
Size 3.2 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bc3598b2bad3ef84f5717590ca6c03cda869c6010711318d42c4a73e92b48695
BLAKE2b-256 checksum
How to use checksums
d4274781ec05579748024e30f143b0c20cc0044762286edc57e845045d383608
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release history Release notifications | RSS feed

This release

2.1.2 This release

3 release files

2.1.1

3 release files

2.1.0

3 release files

2.0.0

3 release files

1.0.8

2 release files

1.0.6

2 release files

0.9.8

2 release files

0.9.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page