Cross-platform Bilibili video/audio downloader built on yt-dlp + ffmpeg.
Project description
bili-dl
Cross-platform Bilibili downloader — a thin, fast wrapper around
yt-dlp+ffmpeg.
Download Bilibili videos and audio at the best available quality (up to 1080p for non-premium accounts). Cross-platform, zero runtime dependencies, foobar2000-friendly audio output.
Features
- Cookie-safe — drop
cookies_all.txtnext to the tool, and only the.bilibili.comentries are extracted. Other-site cookies are never parsed, stored, or sent anywhere. - Cookie-verified — probes Bilibili's
navAPI to confirm your session is actually logged in before downloading. - foobar2000-friendly audio — every produced M4A goes through a zero-loss
ffmpeg -c copyremux (moov-first + ISOM container). No re-encode, no quality loss, instant playback in picky players. - Zero runtime deps — standard library only. If you have Python,
pipx install bili-dlis all you need.
Install
bili-dl needs yt-dlp and ffmpeg on your PATH:
pip install -U yt-dlp # or: winget / brew / pipx
# ffmpeg:
winget install ffmpeg # Windows
brew install ffmpeg # macOS
sudo apt install ffmpeg # Debian/Ubuntu
Then:
pipx install bili-dl # recommended
bili-dl -V # verify
Quick start
Cookies (one-time)
Bilibili requires a login cookie. Use any browser extension that exports cookies in Netscape format (Cookie-Editor, Get cookies.txt, etc.):
-
Log in to bilibili.com
-
Export All Cookies — the file should look like:
# Netscape HTTP Cookie File .bilibili.com TRUE / FALSE 0 SESSDATA <session> .bilibili.com TRUE / FALSE 0 bili_jct <csrf> -
Save as
cookies_all.txtin the cookie directory:
| OS | Cookie directory |
|---|---|
| Windows | %APPDATA%\bili-dl |
| macOS | ~/Library/Application Support/bili-dl |
| Linux | ~/.config/bili-dl |
Run bili-dl once — it extracts only .bilibili.com entries and reuses them
thereafter. Override with --cookie-dir.
Download
bili-dl # interactive REPL
bili-dl https://www.bilibili.com/video/BV... # one-shot (video + audio)
bili-dl -a https://www.bilibili.com/video/BV... # audio only
bili-dl -v https://www.bilibili.com/video/BV... # video only
| OS | Videos | Audio |
|---|---|---|
| Windows | ~/Videos/bilibili_videos |
~/Music/bilibili_audio |
| macOS | ~/Movies/bilibili_videos |
~/Music/bilibili_audio |
| Linux | ~/Downloads/bilibili_videos |
~/Downloads/bilibili_audio |
Override with --output-dir / --audio-dir.
CLI reference
| Flag | Description |
|---|---|
--all |
video + audio, merged MP4 + extracted M4A (default) |
-v, --video |
video only (MP4) |
-a, --audio |
audio only (M4A, faststart ISOM) |
-k, --insecure |
skip TLS certificate verification |
--proxy URL |
proxy for yt-dlp |
-V, --version |
show version |
-h, --help |
show help |
Privacy
- Only
.bilibili.comcookie lines are kept; all others are discarded in memory — never written to disk or sent anywhere. - Network requests go only to
api.bilibili.com(login probe) and the URLs you provide (viayt-dlp). No telemetry, no analytics. cookies_bilibili.txtis created with a timestamped backup before any overwrite.
License
MIT. bili-dl is a wrapper; the actual downloading is done by
yt-dlp (Unlicense) and
ffmpeg (LGPL/GPL), which you must install separately.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bili_dl-0.1.3.tar.gz.
File metadata
- Download URL: bili_dl-0.1.3.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ff6915af1fcfe98bb6e4d86177d7e544552fc98f0ec33898dafeccf8a1cd222
|
|
| MD5 |
dc83bba6783d9702c6e41ff81d6ac9fd
|
|
| BLAKE2b-256 |
ae90a96c59f15877b0f20dd25d5b3634b0c223d9e28ba3f0605581afd40ead44
|
Provenance
The following attestation bundles were made for bili_dl-0.1.3.tar.gz:
Publisher:
publish.yml on Echoziness/bili-dl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bili_dl-0.1.3.tar.gz -
Subject digest:
7ff6915af1fcfe98bb6e4d86177d7e544552fc98f0ec33898dafeccf8a1cd222 - Sigstore transparency entry: 1983683929
- Sigstore integration time:
-
Permalink:
Echoziness/bili-dl@0840a99e31d9dc3c618f485bbf29ae7758d17e24 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Echoziness
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0840a99e31d9dc3c618f485bbf29ae7758d17e24 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bili_dl-0.1.3-py3-none-any.whl.
File metadata
- Download URL: bili_dl-0.1.3-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f5de7421aaac0374a1b0c293615198374c7775061b78fa7533a77324704df4c
|
|
| MD5 |
78ab5f6eb20bd3a365520a89c0d9e101
|
|
| BLAKE2b-256 |
127ca7f80ec939d919c8b9ad092b8c5c3bc6e4241b0916090e125244d77fdaf8
|
Provenance
The following attestation bundles were made for bili_dl-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on Echoziness/bili-dl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bili_dl-0.1.3-py3-none-any.whl -
Subject digest:
2f5de7421aaac0374a1b0c293615198374c7775061b78fa7533a77324704df4c - Sigstore transparency entry: 1983684198
- Sigstore integration time:
-
Permalink:
Echoziness/bili-dl@0840a99e31d9dc3c618f485bbf29ae7758d17e24 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Echoziness
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0840a99e31d9dc3c618f485bbf29ae7758d17e24 -
Trigger Event:
push
-
Statement type: