# Bilibili Danmaku Scraper 哔哩哔哩弹幕提取 (No Cookie)—XML & Peak (`axon-studio/bilibili-danmaku-scraper`) Actor

\[100% No Cookie / No Login — $4.5/1k] Extract real-time XML danmaku (弹幕 / bullet comments) from Bilibili (哔哩哔哩) videos. Capture exact video timestamps (02:05), peak high-energy minutes (peakMinute), sender hashes & keyword-filtered bullets for AI/LLM training.

- **URL**: https://apify.com/axon-studio/bilibili-danmaku-scraper.md
- **Developed by:** [Axon Studio](https://apify.com/axon-studio) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.80 / 1,000 item-scrapeds

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

Extract real-time XML **danmaku (弹幕 / bullet comments)**, exact video appearance timestamps (`videoTimeFormatted`), high-energy **peak reaction minutes (`peakMinute`)**, and sender hashes from **Bilibili (哔哩哔哩 / bilibili.com)** — China's premier Gen-Z video, gaming, ACG, and tech review platform.

Built for **AI/LLM multimodal dialogue training corpora, video highlight detection, gaming & tech launch reception analysis, and automated RAG pipelines** (n8n, Make, Dify, Claude MCP). **100% no login, no cookies, and no VPN required.** Users on the **Apify Free plan ($5 monthly credit) can extract up to 1,111 Bilibili danmaku bullet comments per month for free**.

***

### What Can This Bilibili Danmaku Scraper Do? (Features)

| Bilibili Danmaku Capability | Built-In Advantage |
| :--- | :--- |
| **Native XML Danmaku Stream Parsing (`list.so`)** | Directly extracts Bilibili's real-time bullet comment pool by `bvid`, `aid`, or video URL without browser overhead or login cookies. |
| **Peak High-Energy Minute Detection (`peakMinute`)** | Automatically buckets bullet comments across the video timeline to pinpoint the exact 1-minute window (e.g., `"02:00-02:59"`) where viewer reactions peak. |
| **Smart Density Sampling (Zero Opening Spam)** | Instead of only grabbing `"前排"` spam from the first `00:00` second, the engine samples across peak-density moments and the full video timeline sorted chronologically. |
| **Danmaku Keyword Filtering (`danmakuKeyword`)** | Optionally filter bullet comments by specific substrings (e.g., `"高能"`, `"泪目"`, `"遥遥领先"`, `"价格"`) to isolate targeted viewer reactions. |
| **Automatic Keyword Video Discovery** | Don't have specific `BV` IDs? Leave `videoIds` empty and enter any English or Chinese topic in `searchQuery` to auto-discover top videos and harvest their danmaku. |
| **256 MB RAM Real-Time Streaming** | Streams bullet records to your Apify Dataset in real-time batches of 10 rows on just **256 MB RAM**, supporting scheduled runs (`deltaMode`) and **JSON, CSV, Excel, or Parquet** exports. |

***

### How to Scrape Bilibili Danmaku in 3 Easy Steps

1. **Enter Target Videos (`videoIds`)** — Paste one or more Bilibili `BV` IDs (e.g., `BV1r94y1H77U`), `av` numbers, or full video URLs; OR leave `videoIds` empty and enter a topic in `searchQuery`.
2. **Set `maxResults` & Optional Filter** — Choose how many bullet comments to extract (`1` to `10,000`) and optionally enter a `danmakuKeyword` filter.
3. **Click "Start"** — Download your time-aligned danmaku dataset in **JSON, CSV, Excel, or Parquet**, or connect via REST API, n8n, Make, or Claude MCP.

***

### Bilibili Danmaku Scraper Use Cases

| Buyer Profile | Bilibili Danmaku & Timestamp Intelligence Use Case |
| :--- | :--- |
| **AI / LLM & Multimodal Training Teams** | Build time-aligned video-to-text reaction corpora pairing exact video timestamps (`videoSecond`) with colloquial Chinese crowd commentary |
| **Gaming & Consumer Tech Brands** | Pinpoint which exact second of a product keynote, game trailer (`Black Myth Wukong`), or smartphone teardown triggered the biggest audience reaction (`peakMinute`) |
| **Video Editors & MCN Agencies** | Automatically detect viral highlight moments and crowd catchphrases across long-form Bilibili videos |
| **Academic NLP & Cultural Researchers** | Study real-time synchronous bullet-curtain (`弹幕`) linguistics, subculture slang, and viewer engagement dynamics |

***

### Input

All parameters are configured in the **Input** tab. Below is the complete input parameter reference table matching the schema and JSON input examples:

| Input Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| **`videoIds`** | `array` | `["BV1r94y1H77U"]` | Target Bilibili BV IDs, av numbers, or full video URLs. Leave empty `[]` to auto-discover videos via `searchQuery`. |
| **`danmakuKeyword`** | `string` | `""` | Optional substring filter to only return bullet comments containing specific words. Leave empty for full peak-density sampling. |
| **`maxResults`** | `integer` | `100` | Maximum number of danmaku bullet comment rows to return (`1` to `10,000`). |
| **`searchQuery`** | `array` | `["黑神话悟空"]` | Fallback keywords in English or Chinese used to auto-discover active videos when `videoIds` is empty. |
| **`autoLocalize`** | `boolean` | `true` | Automatically translates English brand/game keywords into Simplified Chinese during video auto-discovery. |
| **`deltaMode`** | `boolean` | `false` | Remembers scraped `danmakuId` values in Key-Value Store across scheduled runs so only new bullet comments are returned. |
| **`mode`** | `string` | `"danmaku"` | Locked to `"danmaku"` extraction mode. |

#### 1. Extract Peak & Timeline Danmaku from Specific Videos (JSON)

```json
{
  "mode": "danmaku",
  "videoIds": [
    "BV1r94y1H77U",
    "https://www.bilibili.com/video/BV1xrnz6gEVD"
  ],
  "danmakuKeyword": "",
  "maxResults": 200,
  "deltaMode": false
}
```

#### 2. Filter Danmaku by Keyword or Auto-Discover Videos (JSON)

```json
{
  "mode": "danmaku",
  "videoIds": ["BV1r94y1H77U"],
  "danmakuKeyword": "高能",
  "maxResults": 100
}
```

***

### Output

All scraped bullet comments are stored in your Apify **Dataset** and can be exported to JSON, CSV, Excel, XML, or Parquet. Below is a sample JSON output matching the `"BV1r94y1H77U"` input above:

```json
{
  "mode": "danmaku",
  "danmakuId": "16123456789012345",
  "bvid": "BV1r94y1H77U",
  "aid": 1130123456,
  "cid": 1612345678,
  "title": "《黑神话：悟空》最终预告 | 8月20日，重走西游",
  "text": "前方高能！四大天王这压迫感绝了！",
  "videoSecond": 125.4,
  "videoTimeFormatted": "02:05",
  "peakMinute": "02:00-02:59",
  "danmakuMode": 1,
  "fontSize": 25,
  "colorHex": "#FFFFFF",
  "senderHash": "a1b2c3d4",
  "videoUrl": "https://www.bilibili.com/video/BV1r94y1H77U",
  "createdAtIso": "2024-08-08T02:18:45Z",
  "scrapedAtIso": "2026-10-28T10:30:00Z"
}
```

#### Output Field Definitions

- **`danmakuId`**: Unique Bilibili bullet comment ID (used for deduplication in `deltaMode`).
- **`bvid` / `aid` / `cid`**: Parent video BV ID, numeric archive ID, and video player cid.
- **`text`**: Clean bullet comment text in Simplified Chinese.
- **`videoSecond` / `videoTimeFormatted`**: Exact timestamp in the video where the bullet comment appears (in seconds `125.4` and `MM:SS` format `"02:05"`).
- **`peakMinute`**: The 1-minute window in the parent video with the highest overall danmaku density (e.g., `"02:00-02:59"`).
- **`colorHex` / `fontSize` / `danmakuMode`**: Visual styling metadata (`#FFFFFF`, font size, scrolling vs. top/bottom pinned mode).
- **`senderHash`**: Anonymized CRC32 hash of the bullet sender's account ID.

***

### Automated Daily Danmaku Monitoring (Schedules & Delta Mode)

Track new bullet comments on viral videos automatically:

1. Go to **Apify Console → Schedules → Create new schedule** and select **`axon-studio/bilibili-danmaku-scraper`**.
2. Set **`deltaMode: true`** in your input JSON. Previously delivered `danmakuId` records are stored in persistent storage and skipped on future runs—so you only pay for newly posted bullet comments.

#### Python & Synchronous REST API Integration

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")
run = client.actor("axon-studio/bilibili-danmaku-scraper").call(run_input={
    "mode": "danmaku",
    "videoIds": ["BV1r94y1H77U"],
    "maxResults": 100,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["videoTimeFormatted"], item["peakMinute"], item["text"])
```

```bash
curl -X POST "https://api.apify.com/v2/acts/axon-studio~bilibili-danmaku-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode":"danmaku","videoIds":["BV1r94y1H77U"],"maxResults":50}'
```

***

### How Much Does It Cost to Scrape Bilibili Danmaku? (Pricing)

**$4.50 per 1,000 danmaku items (`$0.0045` per bullet comment) + `$0.02` per Actor start (Pay-Per-Event)**

- **Free Plan Credits**: Every Apify account includes **$5.00 in free monthly credits**, covering up to **1,111 Bilibili danmaku bullet comments every month for free**.
- **Volume Discounts**: Automatic lower unit prices for Apify **Bronze / Starter**, **Silver / Scale**, and **Gold / Business** plan subscribers.
- **No Extra Server Compute Fees**: Runs on just 256 MB RAM with platform compute usage fully included.
- **Typical Run Costs**: 100 bullet comments = **`$0.47`** · 500 bullet comments = **`$2.27`** · 1,000 bullet comments = **`$4.52`**.

***

### FAQ & Legal Compliance

#### Do I need a Bilibili login or `SESSDATA` cookie to extract XML danmaku?

**No.** This Actor resolves the video's player `cid` and parses Bilibili's public XML danmaku stream automatically without requiring user credentials.

#### Is it legal to scrape public Bilibili danmaku?

This Actor extracts publicly visible bullet comments and anonymized sender hashes displayed on `bilibili.com`. Under **GDPR** and **PIPL**, ensure you have a lawful basis for NLP research or market analytics. *Not affiliated with Bilibili Inc.*

***

### More Chinese Social Intelligence Scrapers by Axon Studio

- **[Bilibili Scraper 哔哩哔哩 (No Cookie) — All-in-One Videos, Danmaku, Comments & Creators](https://apify.com/axon-studio/bilibili-scraper)** — Full 8-mode Bilibili intelligence suite.
- **[Bilibili Comments & IP Geolocation Scraper](https://apify.com/axon-studio/bilibili-comments-scraper)** — Extract Bilibili comment threads and English IP province locations (`regionEn`).
- **[Bilibili Creator Videos & UP Profile Scraper](https://apify.com/axon-studio/bilibili-creator-videos-scraper)** — Extract UP creator video uploads and KOL follower profiles without `-352` blocks.
- **[Weibo Scraper 微博 (No Cookie) — Search, Posts, Comments & BlackCat](https://apify.com/axon-studio/weibo-scraper)** — 9-mode Sina Weibo & BlackCat social listening suite.
- **[BlackCat Scraper 黑猫投诉 — China Consumer Complaints API](https://apify.com/axon-studio/blackcat-complaints-scraper)** — Extract Chinese consumer disputes from `tousu.sina.com.cn`.

# Actor input Schema

## `videoIds` (type: `array`):

Paste Bilibili BV IDs (e.g., 'BV1r94y1H77U'), av numbers, or full video URLs. If left empty, the scraper will automatically find videos matching 'Search Keywords' below and extract their danmaku.

## `danmakuKeyword` (type: `string`):

Only keep bullet comments containing this text (e.g., '高能', '泪目'). Leave empty to sample across peak high-energy minutes and the full video timeline.

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

Maximum number of danmaku records to extract (1 - 10,000).

## `searchQuery` (type: `array`):

Keywords in English or Chinese to auto-discover videos when no specific BV ID is provided.

## `autoLocalize` (type: `boolean`):

Automatically translate English keywords into Chinese during video auto-discovery.

## `deltaMode` (type: `boolean`):

Skip previously scraped danmaku bullet IDs across scheduled runs.

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

Locked to danmaku extraction mode.

## Actor input object example

```json
{
  "videoIds": [
    "BV1r94y1H77U"
  ],
  "danmakuKeyword": "",
  "maxResults": 100,
  "searchQuery": [
    "黑神话悟空"
  ],
  "autoLocalize": true,
  "deltaMode": false,
  "mode": "danmaku"
}
```

# 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 = {
    "videoIds": [
        "BV1r94y1H77U"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("axon-studio/bilibili-danmaku-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 = { "videoIds": ["BV1r94y1H77U"] }

# Run the Actor and wait for it to finish
run = client.actor("axon-studio/bilibili-danmaku-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 '{
  "videoIds": [
    "BV1r94y1H77U"
  ]
}' |
apify call axon-studio/bilibili-danmaku-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,axon-studio/bilibili-danmaku-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/f1GfzdUucJcZz2pq4/builds/7bR5bieuUlH6BbecK/openapi.json
