btdl#
btdl is a pure command-line client for Tidal, built on the
binary-tidal-py
library. It is the command-line surface of the whole library:
search the catalog, resolve links, check what a download would do,
download collections with resume and per-item failure isolation,
stream tracks to stdout or files, and maintain the local library
(transcode, probe, purge, diagnose).
No TUI, no global state, no surprise I/O:
results go to stdout — an aligned table by default, or the exact JSON payload with
--jsonon every command;progress and errors go to stderr, so a pipe or a
jqconsumer never sees anything but the payload;exit codes are a stable contract (
0ok,1a Tidal error,130cancelled,2usage/internal — see the output contract);the library’s resume, skip-existing, quality-downgrade chain, and retry behavior comes along for the ride, because
btdlis a thin surface over it.
Install#
btdl is published to the binarycollective Forgejo package registry
under the name binary-tidal-cli.
$ uv tool install \
--index-url https://git.binarycollective.de/api/packages/binary/pypi/simple \
binary-tidal-cli
$ btdl --version
pip works the same way
(pip install binary-tidal-cli --index-url https://git.binarycollective.de/api/packages/binary/pypi/simple),
as does a source checkout with uv sync --group dev.
System requirement: ffmpeg/ffprobe on PATH for
maintain transcode and maintain probe; the download pipeline
uses them only for the optional --save-as-flac remux and the
--verify-media ffprobe pass (turn both off and downloads need no
ffmpeg at all). Everything else works without it.
Quick start#
Log in once (see login for the options):
$ btdl auth device-login
device login
open: https://link.tidal.com/activate
enter: ABCD-EFGH
...
logged in as user 1234567
Then browse and grab:
$ btdl search "daft punk" --type albums
$ btdl tracks <album-url>
$ btdl plan <album-url> # what a download would do
$ btdl download <album-url> # resume, per-item isolation
$ btdl stream <track-url> -o track.flac
Every one of those also takes --json:
$ btdl search "daft punk" --type albums --limit 5 --json | jq '.items[0].title'
Global options#
Every command accepts the same global options, settable per call or
via environment variables. They map one-to-one onto the library’s
Config — the full surface is available, so btdl is scriptable the
way the library is.
Session#
Option |
Env |
Default |
Meaning |
|---|---|---|---|
|
|
library default |
the saved-login (token) file |
|
|
|
the download output root |
|
|
|
|
|
|
library default |
OAuth client id ( |
|
|
none |
proxy URL for the transport |
|
— |
|
connect timeout, seconds |
|
— |
|
read timeout, seconds |
|
— |
off |
|
|
— |
— |
print the version and exit |
|
— |
— |
install tab completion for the current shell |
|
— |
— |
print the completion script (copy/customize) |
Naming and collection behaviour#
Option |
Env |
Default |
Meaning |
|---|---|---|---|
|
|
|
the track filename path template |
|
|
|
the album directory path template |
|
|
|
the playlist/mix directory path template |
|
|
on |
include EPs and singles in artist downloads |
|
|
none |
comma-separated custom playback ladder — it replaces the built-in downgrade chain, the profile’s own rung included (a rung the order omits is never asked, e.g. |
|
|
on |
keep going past broken items (a per-run |
Network#
Option |
Env |
Default |
Meaning |
|---|---|---|---|
|
|
|
retries per transient request failure |
|
|
|
retry backoff base, seconds |
|
|
|
429 wait budget per logical request, seconds |
|
|
|
cumulative cap for long server-requested pauses, seconds |
|
|
|
proactive pacing between playback resolutions (0 = adaptive-only) |
|
|
|
polls to wait for an asset still being prepared |
|
|
none |
a custom User-Agent for the transport |
|
|
off |
disable TLS certificate verification (dangerous) |
|
|
none |
a custom CA bundle path (corporate MITM proxies); mutually exclusive with |
|
|
none |
base-URL overrides (replay proxies, testing) |
Downloads#
Option |
Env |
Default |
Meaning |
|---|---|---|---|
|
|
|
byte-range fetch workers per track (distinct from the per-run |
|
|
|
part size for parallel range fetches, bytes (64 KiB–32 MiB) |
|
|
none |
throttle download throughput, bits/s |
|
|
off |
disable the SSRF guard on manifest-supplied media URLs (replay proxies only) |
|
|
|
seconds to wait for the output directory lock when another |
Post-processing#
Option |
Env |
Default |
Meaning |
|---|---|---|---|
|
|
on |
write audio tags (ID3v2.4 / MP4 / FLAC) to finished files |
|
|
off |
fetch per-track lyrics and embed them (one extra API call per item) |
|
|
off |
write a lyric sidecar ( |
|
|
on |
embed collection artwork and write a |
|
|
off |
write an |
|
|
on |
remux FLAC-in-MP4 to true FLAC when ffmpeg is available |
|
|
on |
ffprobe-verify the delivered bytes against the manifest facts |
|
|
off |
write completion receipts; skip only receipt-proven files (the quality-aware skip/upgrade path) |