spoti-dl: download songs, albums and playlists using Spotify links
Project description
spoti-dl
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:
- Go to Spotify Dev Dashboard
- Login with your credentials and click on "create an app".
- Enter any name of choice, app description, tick the checkbox and proceed.
- Now you have access to your client ID. Click on "Show client secret" to get your client secret.
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file spoti_dl-2.1.2-cp38-abi3-win_amd64.whl
.
File metadata
- Download URL: spoti_dl-2.1.2-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d3044bd5d9959c2b9db00e84aafa80518913c75d497df0d4962bee630fdd2e0 |
|
MD5 | fe9f9b066e35d7e048d5d6fbefe1b95b |
|
BLAKE2b-256 | 62ae6845492f7848de053dc617a7bd600b4996b49fd63cfe3f66dcfb48cc478d |
File details
Details for the file spoti_dl-2.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: spoti_dl-2.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b24115fb1e39e07655c535b7802562ea76ba28fec9575090ea25caa2394b28f2 |
|
MD5 | ea98ce46b698783163b977bca6b7c18a |
|
BLAKE2b-256 | d9a103912201030409998b3b1cf8436a3dedcfd87d410de851ad0b27267c2096 |
File details
Details for the file spoti_dl-2.1.2-cp38-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: spoti_dl-2.1.2-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc3598b2bad3ef84f5717590ca6c03cda869c6010711318d42c4a73e92b48695 |
|
MD5 | 95445187a1347fbb3b05f0d63a106cb9 |
|
BLAKE2b-256 | d4274781ec05579748024e30f143b0c20cc0044762286edc57e845045d383608 |