Skip to main content

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.

CI Python 3.9+ PyPI License: MIT

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.txt next to the tool, and only the .bilibili.com entries are extracted. Other-site cookies are never parsed, stored, or sent anywhere.
  • Cookie-verified — probes Bilibili's nav API to confirm your session is actually logged in before downloading.
  • foobar2000-friendly audio — every produced M4A goes through a zero-loss ffmpeg -c copy remux (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-dl is 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.):

  1. Log in to bilibili.com

  2. Export 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>
    
  3. Save the exported .txt file in the cookie directory (any filename works):

OS Cookie directory
Windows %APPDATA%\bili-dl
macOS ~/Library/Application Support/bili-dl
Linux ~/.config/bili-dl

Run bili-dl once — it auto-detects any .txt file containing Bilibili entries, extracts only those, 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.com cookie 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 (via yt-dlp). No telemetry, no analytics.
  • cookies_bilibili.txt is 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

bili_dl-0.1.5.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bili_dl-0.1.5-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file bili_dl-0.1.5.tar.gz.

File metadata

  • Download URL: bili_dl-0.1.5.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bili_dl-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6e1f05e80b5fcc7058e17456507859c3efc858ceb49003e3170c02c413aeaf6b
MD5 fe334cad45e6f83f52aaad2830043195
BLAKE2b-256 af8eda77c1b29c917284d5a5f162308a8171078e798712b6257228852f11dfb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for bili_dl-0.1.5.tar.gz:

Publisher: publish.yml on Echoziness/bili-dl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bili_dl-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: bili_dl-0.1.5-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

Hashes for bili_dl-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5e0bd2d79cbe8444186e1874a95eefce73b1d05c021cf23f945ccde2695eadc9
MD5 9962ca551cf5d70ab1a170db07d7aa31
BLAKE2b-256 55a9dfcab07148eb3e9fac74ad67543cad9d315f20054a88809e8c1f14824648

See more details on using hashes here.

Provenance

The following attestation bundles were made for bili_dl-0.1.5-py3-none-any.whl:

Publisher: publish.yml on Echoziness/bili-dl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page