# Bilibili Danmaku Scraper - Bullet Comments with Timestamps (`pipiagent/bilibili-danmaku-scraper`) Actor

Scrape danmaku (弹幕, bullet comments) from Bilibili (B站) videos: text, the exact second of the video, send time, color and position. See what viewers reacted to and when. No login needed.

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

## Pricing

$3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Danmaku Scraper

Export danmaku (弹幕, also called bullet comments) from [Bilibili](https://www.bilibili.com) videos. Danmaku are the comments that fly across the video while it plays. Each one is tied to an exact second of the video, so they show what viewers reacted to and when.

Use it to find the moments of a video that got the strongest reaction, to analyze audience sentiment in China, or to build Chinese-language text datasets.

- **Timestamped.** Every danmaku has the second of the video it appears at and the time it was sent.
- **English field names.** Clean JSON, ready for spreadsheets and code. Text stays in Chinese.
- **No login and no proxy needed.**
- **Low price.** $3 per 1,000 danmaku.

### How to use it

1. Click **Try for free**.
2. Paste Bilibili video URLs or BV ids in **Video URLs**. Leave it empty to try the Actor on the most popular video right now.
3. Click **Start**, then download the results as JSON, CSV or Excel.

### Input example

```json
{
    "videoUrls": ["https://www.bilibili.com/video/BV14Baa6JENd", "BV1X4a36KEuH"],
    "maxItems": 5000
}
```

### Output example

```json
{
    "type": "danmaku",
    "danmakuId": "2217085943611977472",
    "videoBvid": "BV14Baa6JENd",
    "videoTitle": "《原神》六周年主题曲《风的来信》",
    "videoUrl": "https://www.bilibili.com/video/BV14Baa6JENd",
    "cid": 42251257840,
    "text": "六周年快乐！",
    "videoTimeSeconds": 2.02,
    "sentAt": "2026-10-07T15:54:00Z",
    "displayMode": "scroll",
    "color": "#ffffff",
    "userHash": "98f1491f",
    "scrapedAt": "2026-10-10T13:51:56Z"
}
```

`displayMode` is `scroll`, `top` or `bottom`. `userHash` is Bilibili's anonymous id of the sender: the same viewer has the same hash, but it does not reveal the account.

### How much does it cost?

You pay per saved result: **$3.00 per 1,000 danmaku**. There is no start fee and no monthly rental.

| Run | Results | Cost |
|---|---|---|
| Danmaku of one typical video | about 300 | $0.90 |
| Danmaku of one very popular video | about 2,300 | $6.90 |

Set a maximum charge per run in the run options and the Actor stops when it is reached.

### Limits you should know

- **Very popular videos return a sample.** Bilibili keeps a rolling pool of a few hundred to a few thousand danmaku per video, and the Actor returns that pool. Older danmaku that Bilibili has rotated out are not available.
- **Videos with several parts** return the danmaku of every part, with a `videoPart` number.
- **Deleted and private videos are skipped** with a warning.

### Related Actors

- [Bilibili Scraper](https://apify.com/pipiagent/bilibili-scraper): video search, video statistics, creator profiles, uploads, rankings and comments.
- [Bilibili Search Scraper](https://apify.com/pipiagent/bilibili-search-scraper): find videos by keyword.

### FAQ

**Is it legal?** The Actor collects only data that Bilibili shows publicly to every visitor. Results can contain personal data such as usernames. Make sure you have a legitimate reason to process it, as required by the GDPR and similar laws.

**Something is broken or missing?** Open a ticket in the Issues tab. Issues are usually answered within a day.

# Actor input Schema

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

Bilibili video URLs, b23.tv short links, BV ids or av ids. Leave empty to try the Actor on the most popular video right now.

## `maxItems` (type: `integer`):

Maximum number of results to save in this run. You are only charged for saved results.

## `maxItemsPerQuery` (type: `integer`):

Optional. Limits results for each video, so that one video does not use up the whole run.

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

Optional. The Actor works without a proxy. Turn one on only if runs start failing with blocked requests.

## Actor input object example

```json
{
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Danmaku saved by the run, one item per danmaku.

# 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("pipiagent/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 = {}

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pipiagent/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/Wzue4di5v96V2ca48/builds/jgqI2jbpfqvXaA5Tu/openapi.json
