# Bilibili Scraper: Search, Uploads, Danmaku, Transcripts (`dimpled_academy_qp4/bilibili-scraper`) Actor

Scrape public Bilibili (B站) data without login: keyword search, video details with stats and tags, complete creator upload lists, full danmaku (bullet comments), popular feed, rankings, and speech-to-text transcripts in Simplified Chinese.

- **URL**: https://apify.com/dimpled_academy_qp4/bilibili-scraper.md
- **Developed by:** [Cona Guo](https://apify.com/dimpled_academy_qp4) (community)
- **Categories:** Social media, Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 video records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
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 Scraper — Search, Videos, Creator Uploads, Danmaku, Transcripts

Scrape public data from [Bilibili](https://www.bilibili.com) (B站), China's largest video community,
without login or cookies. Seven modes:

| Mode | Input | Output |
|---|---|---|
| `search` | keywords | videos matching each keyword (up to 1,000 per keyword, Bilibili's own cap) |
| `video_detail` | video URLs / BV IDs / av IDs | full stats: views, likes, coins, favorites, shares, comments, danmaku count, tags |
| `user_videos` | creator IDs (mid) or space URLs | **the complete upload list** of each creator, newest first |
| `danmaku` | video URLs / BV IDs | **full danmaku (bullet comment) text** with video timestamp, mode, color, send time; all parts of multi-part videos |
| `popular` | — | the current popular feed |
| `ranking` | optional category ID | the top 100 ranking |
| `transcript` | video URLs / BV IDs | **speech-to-text transcript** in Simplified Chinese with per-segment timestamps, for every part of the video |

### Why this Actor

- **Complete creator uploads.** Paginates the creator's own upload list instead of searching by name,
  so you get every public video, not just what search surfaces.
- **Raw danmaku text**, timestamped to the second of the video: ready for sentiment analysis,
  highlight detection, or LLM pipelines.
- **Flat, typed records** (ISO dates, seconds, numbers) that drop straight into spreadsheets, BI tools or AI agents.
- **No login, no cookies.** Public data only.

### Output example (video)

```json
{
  "bvid": "BV1GJ411x7h7",
  "url": "https://www.bilibili.com/video/BV1GJ411x7h7",
  "title": "【官方 MV】Never Gonna Give You Up - Rick Astley",
  "durationSec": 213,
  "publishedAt": "2019-12-31T23:43:23.000Z",
  "ownerMid": 486906719,
  "ownerName": "索尼音乐中国",
  "views": 107488601, "likes": 2958870, "coins": 1285522, "favorites": 1556417,
  "shares": 500693, "comments": 238211, "danmakuCount": 151037,
  "tags": ["Rick Astley", "MV", "欧美音乐"],
  "source": "video_detail"
}
```

### Output example (danmaku)

```json
{ "bvid": "BV1GJ411x7h7", "part": 1, "timeSec": 12.5, "text": "前方高能", "mode": "scroll",
  "color": "#ffffff", "sentAt": "2021-02-19T11:32:56.000Z" }
```

### Transcripts

Bilibili only shows subtitles to logged-in users, and most videos have none. This mode downloads the
public audio track and runs speech recognition (Whisper large-v3 turbo on Groq), then converts the
output to Simplified Chinese with full-width punctuation.

- Accuracy is high for clear narration (documentaries, tutorials, talks) and lower for strong accents,
  fast banter or loud background music. Proper nouns and brand names are the most common errors.
- Billed per started minute of audio. Parts longer than **Max minutes per video part** are skipped and not billed.
- Bring your own Groq API key for a lower per-minute price.

```json
{ "bvid": "BV1pGnn67EbB", "part": 1, "durationSec": 2682, "billedMinutes": 45, "language": "zh",
  "text": "Sabrina是一位在OnlyFans上大约前百分之五的创作者。……",
  "segments": [{ "start": 58.0, "end": 66.1, "text": "Sabrina是一位……" }] }
```

### How to use

1. Pick a **Mode** and fill the matching input: keywords for `search`; video URLs or BV IDs for
   `video_detail`, `danmaku` and `transcript`; creator IDs or space URLs for `user_videos`.
2. Set **Max videos per keyword / creator / list** and click **Start**.
3. Open the **Output** tab and export to CSV, Excel or JSON, or read the dataset through the API.

Call it from code with the [Apify API client](https://docs.apify.com/api/client/python):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("dimpled_academy_qp4/bilibili-scraper").call(run_input={
    "mode": "user_videos", "userIds": ["https://space.bilibili.com/946974"], "maxResults": 50,
})
for video in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(video["publishedAt"][:10], video["views"], video["title"])
```

Recipes: find creators in a niche (`search`, then sort by views); track a competitor's channel weekly
(`user_videos` plus an Apify schedule); find highlight moments (`danmaku`, count per 30-second window);
feed videos to an LLM (`transcript`).

### 中文快速上手

本工具无需登录即可采集 B 站公开数据：关键词搜索、视频详情、UP 主全部投稿、弹幕、热门、排行榜，以及语音转文字（输出简体中文文字稿）。

使用方法：在 **Mode** 中选择模式并填写对应输入，即关键词、视频链接或 BV 号、UP 主 ID 或空间链接；设定数量上限后点击 **Start**；运行完成后，在 **Output** 标签页导出 CSV、Excel 或 JSON。BV 号位于视频链接中，UP 主 ID 即空间链接 `space.bilibili.com/` 后的数字。

费用按成功写入的记录计算，失败与跳过的条目不收费，详见下方 Pricing。

### Notes and limits

- `search` and `user_videos` results come from list endpoints that lack coins, shares and full tags.
  Turn on **Fetch full details** to fill them (2 extra requests per video, slower).
- Video `category` names are no longer returned by Bilibili's detail endpoint; `categoryId` is provided.
- Some videos are restricted to mainland China (for example, licensed music videos). Outside China
  Bilibili answers "not found" (-404) for them; they are skipped with a warning.
- Full comment threads and official subtitles require a logged-in account on Bilibili and are **not**
  scraped; use the `transcript` mode to get the spoken text instead.
- Danmaku: Bilibili serves a capped pool per video part (often a few thousand items). If the pool is larger
  than **Max danmaku per video**, an even sample across the whole video timeline is returned.
- Bilibili throttles by IP. The Actor retries with a fresh visitor identity and, if you enable a proxy,
  a fresh proxy session. If a page still fails, it is skipped and listed in the key-value store
  (`FAILED_PAGES_<mid>`) instead of failing the run.
- Personal data: the Actor outputs creator names and IDs (public channel info) and never outputs
  danmaku sender identifiers. You are responsible for using the data lawfully.

### Pricing

Pay per result. You pay only for records written to the dataset; skipped or failed items are free.

| Event | Free / Bronze | Silver | Gold and above |
|---|---|---|---|
| Video record (any mode except danmaku) | $0.004 | $0.0035 | $0.003 |
| Danmaku record | $0.0001 | $0.0001 | $0.00008 |
| Transcript, per started audio minute | $0.005 | $0.0045 | $0.004 |
| Transcript with your own Groq key, per minute | $0.002 | $0.002 | $0.0015 |

Plus Apify's standard Actor start fee ($0.00005 per run). Set **Max cost per run** to cap spending;
the Actor stops cleanly when the limit is reached.

# Actor input Schema

## `mode` (type: `string`):

What to scrape.

## `keywords` (type: `array`):

Used in search mode. Chinese or English keywords. Bilibili returns at most 1,000 results per keyword.

## `videoUrls` (type: `array`):

Used in video_detail, danmaku and transcript modes. Accepts https://www.bilibili.com/video/BV..., BV IDs, or av IDs.

## `userIds` (type: `array`):

Used in user_videos mode. Accepts numeric mid or https://space.bilibili.com/<mid>.

## `rankingCategoryId` (type: `integer`):

Used in ranking mode. 0 = all categories.

## `maxResults` (type: `integer`):

Upper limit of video records for each keyword, each creator, the popular feed, or the ranking.

## `maxDanmakuPerVideo` (type: `integer`):

Used in danmaku mode.

## `includeDetails` (type: `boolean`):

Search and user_videos results lack coins, shares and full tags. Enable to fetch them (slower, 2 extra requests per video).

## `transcriptLanguage` (type: `string`):

Used in transcript mode. 'zh' (Mandarin, output in Simplified Chinese) or 'auto' to detect.

## `maxTranscriptMinutes` (type: `integer`):

Used in transcript mode. Longer video parts are skipped (not billed).

## `groqApiKey` (type: `string`):

Used in transcript mode. If set, speech recognition runs on your own Groq account and a cheaper per-minute price applies.

## `proxyConfiguration` (type: `object`):

Optional. Bilibili usually works without a proxy; enable if you see repeated risk-control retries.

## Actor input object example

```json
{
  "mode": "search",
  "keywords": [
    "原神"
  ],
  "rankingCategoryId": 0,
  "maxResults": 100,
  "maxDanmakuPerVideo": 3000,
  "includeDetails": false,
  "transcriptLanguage": "zh",
  "maxTranscriptMinutes": 90,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Scraped records (videos or danmaku) in the default dataset.

## `videos` (type: `string`):

Video records with the main stats as columns.

## `danmaku` (type: `string`):

Danmaku records with video timestamp and text.

# 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 = {
    "keywords": [
        "原神"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dimpled_academy_qp4/bilibili-scraper").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 = { "keywords": ["原神"] }

# Run the Actor and wait for it to finish
run = client.actor("dimpled_academy_qp4/bilibili-scraper").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 '{
  "keywords": [
    "原神"
  ]
}' |
apify call dimpled_academy_qp4/bilibili-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dimpled_academy_qp4/bilibili-scraper"
        }
    }
}
```

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/sZEs98rgskmue3ICN/builds/JxABZFwIYn6qNnRUb/openapi.json
