# Bilibili All-in-One API (`romy/bilibili-all-in-one-api`) Actor

Unofficial always-on REST API for Bilibili (哔哩哔哩): popular/ranking/weekly-picks feeds, video detail/playurl/subtitles, filterable search, comments, related videos, tags, danmaku, user profile/uploads/posts/favorites/live status, and UGC video series. No login, cookie, or API key required.

- **URL**: https://apify.com/romy/bilibili-all-in-one-api.md
- **Developed by:** [Romy](https://apify.com/romy) (community)
- **Categories:** Social media, Videos
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $7.80 / 1,000 video details

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Bilibili All-in-One API

Unified REST endpoint for Bilibili (哔哩哔哩) — popular/ranking/weekly-picks
feeds, video detail/playurl/subtitles, filterable search, comments, related
videos, tags, danmaku, user profile/uploads/posts/favorites/live status, and
UGC video series. No login, cookie, or API key required.

### Why

Bilibili's public API has no official docs and mixes several calling
conventions inconsistently across endpoints. Every endpoint below was
verified live (not assumed from third-party documentation) — useful
operational notes for callers:

- `video/comments`'s `mode` (`3`=hot/default, `2`=latest) genuinely reorders
  results. **Pagination beyond the first page is not possible from an
  anonymous caller** — this endpoint always returns exactly 3 replies
  regardless of any `ps`/offset/cursor value tried, even though it
  correctly reports the true total count. It's Bilibili's inline preview
  widget, not the full scrollable thread, and this is the same both on the
  web and in the real app — not a gap in this wrapper.
- `search`'s multi-type endpoint silently **ignores** `order`/`duration`/
  `tids`/`order_sort`. The type-scoped search variant DOES honor `order`
  (`pubdate`/`click`) and `duration` (1-4) and `tids` (category id) — so
  `search()` transparently switches to that variant when any of those are
  given, at the cost of narrowing results to videos only.
- `ranking`'s `type` accepts `origin` and `rookie` as real sub-rankings
  beyond the default `all`. A `day` param some docs mention is a no-op.
- `user/videos`'s `order` accepts `pubdate` (default) and `click`, both
  real. `stow` (a commonly-documented third value) is a silent no-op here.
- `season`'s episode list ignores `pn`/`ps`/`sort` — always returns the
  full collection in one call.
- `favorites`' documented `order` param could not be verified (no public
  account with a multi-item favorite folder was found during testing) —
  not shipped on an unverified guess.
- `user/posts`'s pagination is not reliably possible — the underlying
  offset mechanism is intermittently blank or repeats page 1.
- Bilibili's weekly "must-watch" picks series and annual "precious"
  year-end list are genuinely separate, differently-curated lists from
  both `/popular` and `/ranking`, so they're shipped as their own routes
  (`/popular/weekly`, `/popular/weekly/picks`, `/popular/precious`) rather
  than params.
- **Deliberately not shipped**: a follower/following LIST endpoint
  (only counts are available anonymously — shipping a route here would
  mean silently returning fake-empty data) and official PGC bangumi/anime
  detail (as opposed to `season`'s UGC video collections, which this
  actor does cover) — anime search results look geo/licensing-restricted
  independent of anything this wrapper does.
- A video/region category tree (tid/rid → name mapping) doesn't exist as
  a live API — `ranking`'s `rid` still works with the standard numeric
  region ids (0=all, 1=Anime, etc.) even without a lookup table.

### Endpoints

| Route | Params | Notes |
|---|---|---|
| `GET /popular` | `pn`, `ps` | Trending/popular video feed, paginated |
| `GET /popular/weekly` | — | The list of weekly "must-watch" picks series (`number`/`subject`/date range per week) |
| `GET /popular/weekly/picks` | `number` (from `/popular/weekly`) | One week's curated picks (~8-50 videos) |
| `GET /popular/precious` | — | The annual "must-watch"/"precious" year-end list |
| `GET /ranking` | `rid`, `type` | Full category ranking (up to ~100 videos); `rid=0` is overall "All". `type`: `all` (default), `origin` (original works), `rookie` (rising talent) — each confirmed to return different results |
| `GET /season` | `season_id` | A creator's UGC video series/collection (full episode list, always returned in one call — no pagination/sort support). NOT official bangumi/anime |
| `GET /video` | `bvid` or `aid` | Full video detail (stats, owner, description, `cid` for danmaku/playurl/subtitle) |
| `GET /video/playurl` | `bvid`, `cid`, `qn` | Actual DASH stream URLs (video/audio tracks, quality options) |
| `GET /video/subtitle` | `bvid`, `cid` | CC/subtitle track list (empty array is a real result for videos with no subs) |
| `GET /search` | `keyword`, `page`, `order`, `duration`, `tids` | Multi-category search (video/user/live/article) by default; `order`/`duration`/`tids` narrow to video-only results (see "Why") |
| `GET /video/comments` | `aid`, `mode` | Top-level comments — always capped at 3 (see "Known limitations"). `mode`: `3`=hot (default), `2`=latest |
| `GET /video/related` | `bvid` | Related/recommended videos |
| `GET /video/tags` | `bvid` | Tags attached to a video |
| `GET /video/danmaku` | `oid` (= video's `cid`, not bvid/aid), `segment` | Scrolling danmaku comments, decoded from Protobuf |
| `GET /user` | `mid` | Public user-space profile card (web API, lighter payload) |
| `GET /user/detail` | `mid` | Full space bootstrap payload — richer profile card (rank, vip, official_verify, honours...) |
| `GET /user/home` | `mid` | Same payload as `/user/detail` — the app renders the same response as both the profile "detail" info and the space page's "Home" tab preview (recent uploads/articles), there's no separate endpoint for each |
| `GET /user/videos` | `mid`, `pn`, `ps`, `order` | A creator's full uploaded-video list, paginated. `order`: `pubdate` (default) or `click` confirmed working |
| `GET /user/favorites` | `mid` | A user's public favorite folders (id/title/media_count) |
| `GET /favorites` | `media_id`, `pn`, `ps` | Videos inside one favorite folder (`media_id` from `/user/favorites`) |
| `GET /user/live` | `mid` | Whether a user has a live room + basic status |
| `GET /live` | `room_id` | Full live room detail (viewer count, area, tags, PK state, etc) |
| `GET /user/relations` | `mid` | Follower/following **counts** only (no list endpoint — see "Why" above) |
| `GET /user/posts` | `mid` | The space page's "Posts" tab — dynamic/short-form updates, distinct from uploaded videos. No pagination available (anonymous callers only ever get the first page). |

Every successful response is `{ "success": true, "data": <raw Bilibili API data> }`.
Errors are `{ "success": false, "error": "<message>" }` with a matching HTTP status.

### Known limitations

- `video/comments` only ever returns 3 replies, always the first "page" —
  this isn't a missing-feature gap, it's confirmed live that the endpoint
  itself caps out there for an anonymous caller regardless of any
  pagination param tried (see "Why" above). A real logged-in session would
  likely be needed to get the true scrollable thread.
- `video/danmaku` fetches one ~6-minute segment at a time (`segment` param);
  long videos need multiple calls with increasing segment numbers.
- `user/posts` has no working pagination for an anonymous caller — only the first page of a profile's dynamic/short-form updates is reliably reachable.
- This is imported on Apify (`romy/bilibili-all-in-one-api`, id
  `UkKBb9ThdDHeB40tb`) but still unpublished (`isPublic: false`). Pricing
  and SEO metadata are already live on the actor object (see "Pricing"
  below) so it's publish-ready, but hasn't been submitted to the Store.

### Pricing

Researched 2026-09-03 against the live Apify Store: 18 existing Bilibili
scrapers (market leader `zhorex/bilibili-scraper`, 743 users / ~15k runs,
charges $0.02/item + $0.05 for a danmaku-profile addon; most others
cluster $0.001-$0.01/item for simple dataset rows) and this account's own
"all-in-one API" Standby actors of similar shape (e.g. `kick-all-in-one-api`,
$0.006-$0.02/event depending on payload richness) for calibration. Those
existing actors are scraper-shaped (pay per dataset row); this one is
API-shaped (pay per call), so prices below track *endpoint value/cost* —
harder-won or richer-payload endpoints cost more — not row count.

Apify caps Pay-Per-Event actors at 20 charge events, so a few
same-value/same-underlying-data routes share one event (documented in the
table below). All events use this account's standard tiered-pricing ladder
(FREE/BRONZE/SILVER/GOLD/PLATINUM/DIAMOND = 100/92/85/78/72/68% of the FREE
price shown); `apify-actor-start`/`apify-default-dataset-item` stay flat at
$0.00005/$0.00001, matching every other actor in this account. **Live on
the actor object as of 2026-09-03** (verified: all 20 `eventName` strings
below match `main.ts`'s `Actor.charge()` calls exactly).

| Event | Route(s) | FREE price | Why this price |
|---|---|---|---|
| `playurl` | `/video/playurl` | $0.020 | Highest value: the actual protected stream URL, needs WBI+buvid |
| `danmaku` | `/video/danmaku` | $0.015 | Hand-rolled Protobuf decode, niche data competitors charge a $0.05 addon for |
| `user-posts` | `/user/posts` | $0.012 | A harder-to-reach endpoint than most others here |
| `season` | `/season` | $0.010 | Full episode list in one call |
| `video` | `/video` | $0.010 | Rich detail payload (stats/owner/description/cid) — primary event |
| `subtitle` | `/video/subtitle` | $0.010 | WBI+buvid signed |
| `user-space` | `/user/detail`, `/user/home` | $0.010 | Rich profile payload — both routes return the identical response |
| `user-videos` | `/user/videos` | $0.010 | Full paginated upload list |
| `live` | `/user/live`, `/live` | $0.008 | Status check or full room detail, sharing one event |
| `favorites` | `/user/favorites`, `/favorites` | $0.007 | Folder list or folder contents, sharing one event |
| `popular-curated` | `/popular/weekly`, `/popular/weekly/picks`, `/popular/precious` | $0.007 | The 3 curated-list routes, sharing one event |
| `ranking` | `/ranking` | $0.008 | List with real `type` sub-ranking variants |
| `search` | `/search` | $0.008 | Multi-category, filterable (order/duration/tids) |
| `popular` | `/popular` | $0.006 | Plain unsigned list |
| `user` | `/user` | $0.006 | Lightweight web-API card |
| `comments` | `/video/comments` | $0.005 | Priced down: hard-capped at 3 replies for anonymous callers |
| `video-extras` | `/video/related`, `/video/tags` | $0.005 | Two lightweight metadata routes, sharing one event |
| `user-relations` | `/user/relations` | $0.005 | Counts only, no list |

### Getting started

```bash
apify run
```

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("romy/bilibili-all-in-one-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("romy/bilibili-all-in-one-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call romy/bilibili-all-in-one-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,romy/bilibili-all-in-one-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/UkKBb9ThdDHeB40tb/builds/VsDqusmr7xjbhHdZJ/openapi.json
