Skip to content
bili

v0.1.0

The first public release of bili: the full command surface, anonymous sessions with WBI signing, and the av/BV and danmaku packages.

The first public release. bili is a single pure-Go binary that puts bilibili.com behind a tool that feels like curl: resolve any id or URL into a rich structured record, pull comments and bullet-chat, search and browse the popular feeds, and crawl the graph into JSONL. It talks to the public web API on api.bilibili.com over plain HTTPS, anonymously by default, so there is no API key to register and nothing to pay for.

What you get

  • Resolve anything. bili id and the per-type commands accept every id form (BV, av, ss/ep/md, au, cv, ml) and full URLs, and normalize before calling.
  • Rich video data. bili video, related, streams, and danmaku cover a video and its parts, with lossless JSON behind a readable table.
  • The conversation. bili comments walks the full comment tree on videos, articles, audio, and dynamics; bili danmaku decodes protobuf bullet-chat into rows.
  • Creators and feeds. bili user, favorites, favorite, dynamics, and dynamic cover an account and what hangs off it.
  • Catalogue. bili bangumi, audio, article, and live read seasons, audio tracks, columns, and live rooms.
  • Discovery. bili search, suggest, trending, popular, and rank find things when you do not have an id yet.
  • Datasets. bili crawl walks the graph from seeds into per-type JSONL files.

Under the hood

  • Anonymous sessions. bili mints the buvid3/buvid4 fingerprint cookies the site expects, so most read endpoints work with no login.
  • WBI signing. It fetches the rotating key pair and signs the w_rid parameter on every endpoint that requires it.
  • Clear errors. The {code, message, data} envelope (and the bangumi result variant) is handled transparently, and the common error codes (risk control, rate limit, not found, login required) map to actionable hints.

Packages you can import

The self-contained helpers live in their own packages, so you can use them from your own program without pulling in the rest of the tool:

import "github.com/tamnd/bilibili-cli/pkg/bvconv"

bvid := bvconv.ToBV(170001)   // "BV17x411w7KC"
aid := bvconv.ToAV(bvid)      // 170001

pkg/bvconv converts between av ids and BV ids; pkg/dmproto decodes protobuf danmaku segments into rows. Neither depends on the bili library or the CLI.

Install

go install github.com/tamnd/bilibili-cli/cmd/bili@latest

Prebuilt archives for Linux, macOS, and Windows, plus Linux packages (deb, rpm, apk) and checksums, are on the release page. The container image is on GHCR:

docker run --rm ghcr.io/tamnd/bili:0.1.0 video BV17x411w7KC

The binary is pure Go with no runtime dependencies.