Bilibili Audio: A Desktop App for Saving Bilibili Soundtracks as .m4a

Wenjing Fang2026-12-01NotesRustTauriGUIProgramming

TIP

Introducing Bilibili Audio, a cross-platform desktop app and CLI built with Tauri, Rust, and React to extract Bilibili DASH audio tracks as .m4a files.

Bilibili hosts music sessions, live sets, talks, and story collections that are easier to listen to offline as plain audio. Saving them usually means downloading full videos and running ffmpeg, or piecing together scripts for multi-part series.

Bilibili Audioopen in new window is a macOS and Windows desktop app built with Tauri, Rust, and React. Paste video IDs, links, or playlist files, pick the tracks you want, and save the original AAC audio straight to .m4a with no re-encoding.

Bilibili Audio light mode showing the Sources panel, Chart Countdown masthead, and live download progress

Targets and Direct DASH Extraction

Paste one target per line: a BVID (BV1kH7b6aER7), one part (BV1kH7b6aER7-3), a range (BV1kH7b6aER7-1-50), or a ?p=N URL. You can also load .txt or .csv playlists (first CSV column, # comments skipped).

The Rust core (src-tauri/src/bili.rs) has no Tauri dependency, so the desktop app and the bilidl CLI share it. One call to /x/web-interface/wbi/view resolves every requested part, deduplicates by cid, and sanitizes file names. For each track, the client requests fnval=16 from /x/player/playurl, picks the highest-bandwidth DASH audio stream, and writes raw AAC-in-MP4 straight to .m4a.

  • Headers and mirrors: API calls send a browser User-Agent to avoid -412 blocks. Media requests include the video Referer and Range: bytes=0- to avoid 567 errors, falling back across backup CDN mirrors on failure.
  • Safe writes and resume: Downloads write to .m4a.part and rename on completion, deleting partial files on error or cancel. Existing files are skipped as Exists, so playlists can be re-run for new entries.
  • Bounded concurrency: A Tokio semaphore limits downloads to three parallel workers to avoid throttling. Progress streams over a Tauri IPC Channel every 256 KiB.

Chart Countdown Interface

Built with React, TypeScript, Tailwind CSS v4, and shadcn/ui, the UI uses a flat "Chart Countdown" layout inspired by 1980s Hong Kong Cantopop chart sheets: paper, ink, and chart blue, bounded by 1px rules and 2px corners with no shadows.

Two-digit track positions and counters use Big Shoulders Display; all text uses Barlow with system CJK fallbacks. Three accents each have one job: yellow for primary actions and completed tracks, magenta for tracks in flight, and red for failures. Above the list, the chart-blue masthead counts down remaining tracks, shows live totals, and fills a single-row progress ladder cell by cell.

Bilibili Audio dark mode showing the Chart Countdown masthead, completed ladder, and track states

Try It

Source code is on GitHub at github.com/cellsummer/bilibili-audio-guiopen in new window. The repository includes both the desktop app and the bilidl CLI:

make dev    # launch desktop app with hot reload
make build  # build macOS .app and .dmg
make cli    # build standalone bilidl binary

Pushing a version tag triggers GitHub Actions to build universal macOS .dmg packages (Apple Silicon and Intel) alongside Windows NSIS, MSI, and portable .exe artifacts.

Last Updated 12/1/2026, 3:25:10 PM