# Bilibili (哔哩哔哩) Danmaku Scraper - Bullet Comments with Timeline (`zen-studio/bilibili-danmaku-scraper`) Actor

Extract Bilibili (哔哩哔哩) danmaku (bullet comments) by video URL or BV id: comment text, timeline position, color, mode, send time, and sender hash. Export to JSON, CSV, or Excel.

- **URL**: https://apify.com/zen-studio/bilibili-danmaku-scraper.md
- **Developed by:** [Zen Studio](https://apify.com/zen-studio) (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 $0.15 / 1,000 danmakus

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Bilibili Danmaku Scraper (哔哩哔哩 / B站) | Bullet Comments with Timeline, Color & Sender (2026)

![Bilibili (哔哩哔哩) danmaku scraper output: bullet comment text, timeline position, color, display mode, send time, and sender as structured JSON](https://iili.io/CuPvzQI.png)

<blockquote style="border-left:4px solid #4C945E;background:#F0FDF4;padding:12px 16px">
<span style="font-size:16px;font-weight:700;color:#1C1917">Every danmaku (弹幕) from a Bilibili (哔哩哔哩) video, with its exact timeline position, color, display mode, send time, and sender, in clean structured JSON.</span>
</blockquote>

<table>
<tr>
<td colspan="4" style="padding:10px 14px;background:#4C945E;border:none;border-radius:4px 4px 0 0">
<span style="color:#FAFAF9;font-size:14px;font-weight:700;letter-spacing:0.5px">Zen Studio · Chinese-platform suite</span>
<span style="color:#E8F5E9;font-size:13px">&nbsp;&nbsp;&bull;&nbsp;&nbsp;Bilibili (B站), Douyin (抖音), RedNote (小红书), Xigua (西瓜视频)</span>
</td>
</tr>
<tr>
<td style="padding:10px 12px;border:1px solid #E7E5E4;background:#E8F5E9;border-right:none;border-top:none;vertical-align:top;width:25%">
<span style="white-space:nowrap">&#9655;&nbsp;<a href="https://apify.com/zen-studio/bilibili-danmaku-scraper" style="color:#4C945E;text-decoration:none;font-weight:700;font-size:13px">Bilibili&nbsp;Danmaku</a></span><br>
<span style="color:#4C945E;font-size:11px;font-weight:600">&#10148; You are here</span>
</td>
<td style="padding:10px 12px;border:1px solid #E7E5E4;border-right:none;border-top:none;vertical-align:top;width:25%">
<span style="white-space:nowrap">&#9655;&nbsp;<a href="https://apify.com/zen-studio/bilibili-video-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:13px">Bilibili&nbsp;Video</a></span><br>
<span style="color:#78716C;font-size:11px">Videos, comments, creators</span>
</td>
<td style="padding:10px 12px;border:1px solid #E7E5E4;border-right:none;border-top:none;vertical-align:top;width:25%">
<span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-3TJaaOJDU1AMiOoJM-Vu2eVr0P6N-douyin-profile-scraper-logo.png" width="20" height="20" style="vertical-align:middle;border-radius:4px"> &nbsp;<a href="https://apify.com/zen-studio/douyin-search-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:13px">Douyin&nbsp;Search</a></span><br>
<span style="color:#78716C;font-size:11px">Keyword video search</span>
</td>
<td style="padding:10px 12px;border:1px solid #E7E5E4;border-top:none;vertical-align:top;width:25%">
<span style="white-space:nowrap"><img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-mHKEEgoDqr6btQQer-fUs5ZquIeN-xiaohongshu-search-scraper-logo-square.png" width="20" height="20" style="vertical-align:middle;border-radius:4px"> &nbsp;<a href="https://apify.com/zen-studio/rednote-search-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:13px">RedNote&nbsp;Search</a></span><br>
<span style="color:#78716C;font-size:11px">小红书 note search</span>
</td>
</tr>
</table>

#### Copy to your AI assistant

````

zen-studio/bilibili-danmaku-scraper on Apify. Scrapes Bilibili (哔哩哔哩) danmaku (bullet comments) from videos, with each comment's timeline position, color, display mode, send time, and sender hash. Call ApifyClient("TOKEN").actor("zen-studio/bilibili-danmaku-scraper").call(run\_input={"videoUrls": \["BV1DYjA6KEJ7"]}), then client.dataset(run\["defaultDatasetId"]).list\_items().items. Optional fields: maxDanmaku (cap per video), startSec / endSec (time window). Full spec: GET https://api.apify.com/v2/acts/zen-studio~bilibili-danmaku-scraper/builds/default (Bearer TOKEN) → inputSchema, actorDefinition.storages.dataset, readme. Token: https://console.apify.com/account/integrations

````

### Key Features

- **22 fields per danmaku**: comment text, exact timeline position (seconds and mm:ss), display mode (scroll / top / bottom), color (hex and decimal), font size, send time, sender hash, weight, pool, and the source video's BV / AV / CID and part.
- **Multi-part aware**: resolves every part (P1, P2, ...) of a video and tags each danmaku with its part index and part title.
- **Timeline slicing**: pull only the danmaku inside a time window with `startSec` / `endSec`, or keep the top-N most relevant per video with `maxDanmaku`.
- **Just paste video URLs or BV ids**: no account, no cookies, no login.
- **Free tier**: 10 lifetime preview runs, up to 100 danmaku per run. No credit card required.

### How to Scrape Bilibili Danmaku

Paste one or more videos into `videoUrls` and run. Each video can be a full URL, a `BV` id, or an `av` number.

#### Basic: one video
```json
{
    "videoUrls": ["https://www.bilibili.com/video/BV1DYjA6KEJ7"]
}
````

#### Several videos at once

```json
{
    "videoUrls": ["BV1DYjA6KEJ7", "av116770799295304", "https://www.bilibili.com/video/BV16D7T6AEP7"]
}
```

#### Cap the danmaku per video

```json
{
    "videoUrls": ["BV1DYjA6KEJ7"],
    "maxDanmaku": 500
}
```

#### Only a time window (e.g. the first two minutes)

```json
{
    "videoUrls": ["BV1DYjA6KEJ7"],
    "startSec": 0,
    "endSec": 120
}
```

### Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `videoUrls` | string\[] | `["https://www.bilibili.com/video/BV1DYjA6KEJ7"]` | One or more Bilibili videos. Accepts a full `bilibili.com/video/...` URL, a `BV` id, or an `av` number. |
| `maxDanmaku` | integer | `0` | Max danmaku per video. `0` = all available. When capped, the most relevant (highest-weight) danmaku are kept, then restored to timeline order. |
| `startSec` | integer | `0` | Only danmaku at or after this many seconds into the video. |
| `endSec` | integer | `0` | Only danmaku at or before this many seconds into the video. `0` = no upper limit. |

### What Data Can You Extract from Bilibili Danmaku?

Every danmaku row includes:

- **Content**: the comment text (HTML entities decoded).
- **Timeline**: exact position in the video as seconds (`videoTimeOffset`) and as `mm:ss` (`videoTimeFormatted`).
- **Appearance**: display `mode` and a readable `modeLabel` (scroll, top, bottom, reverse, advanced, code), `color` as hex and decimal, and `fontSize`.
- **Origin**: send time as ISO date and epoch, an anonymized `senderHash`, the `weight` (Bilibili's relevance / quality score), the `pool` and `poolLabel` (normal, subtitle, special), and the `danmakuId`.
- **Source video**: `videoBvid`, `videoAid`, `cid`, `partIndex`, and `partTitle`.

Fields a danmaku does not provide are returned as `null` rather than dropped, so the column set stays stable across every row.

#### Output Example

A full danmaku row (every field shown):

```json
{
  "type": "danmaku",
  "videoBvid": "BV1DYjA6KEJ7",
  "videoAid": 116770799295304,
  "cid": 39216154197,
  "partIndex": 1,
  "partTitle": "《原神》「『空月之歌·谐谑』映夏！归乡？千灵节！」前瞻特别节目",
  "danmakuId": 2136548701387831040,
  "text": "前排提醒：請不要刷cp",
  "videoTimeOffset": 0.0,
  "videoTimeFormatted": "0:00",
  "mode": 5,
  "modeLabel": "top",
  "fontSize": 25,
  "color": "#E70012",
  "colorDecimal": 15138834,
  "sendTimestamp": 1781787652,
  "sendDate": "2026-06-18T13:00:52+00:00",
  "pool": 0,
  "poolLabel": "normal",
  "senderHash": "1c7dbf4b",
  "weight": 10,
  "scrapedAt": "2026-06-25T08:48:31+00:00"
}
```

### Advanced Usage

Ready-made configurations for content research, sentiment analysis, and highlight detection.

#### The opening minute of a premiere

```json
{
    "videoUrls": ["BV1DYjA6KEJ7"],
    "endSec": 60
}
```

#### Top 1,000 danmaku across several videos

```json
{
    "videoUrls": ["BV1DYjA6KEJ7", "BV16D7T6AEP7"],
    "maxDanmaku": 1000
}
```

#### Reactions around a key moment (e.g. minute 10 to 12)

```json
{
    "videoUrls": ["BV1DYjA6KEJ7"],
    "startSec": 600,
    "endSec": 720
}
```

### Pricing: Pay Per Event (PPE)

You pay per danmaku returned, plus a small base fee for each video that returns danmaku and a fixed fee when a run starts. A video whose danmaku are all filtered out by your time window is not charged the video fee.

| Event | Price | Per 1,000 |
|-------|-------|-----------|
| Danmaku | $0.00015 | $0.15 |
| Video (base fee, per video with danmaku) | $0.00999 | $9.99 |

Free tier: 10 lifetime runs, up to 100 danmaku per run. No credit card required.

### FAQ

**What is danmaku (弹幕)?**
Danmaku are the user comments that scroll across a Bilibili video as it plays, anchored to a moment in the timeline. They are central to Bilibili's culture. This actor returns each individual danmaku message with its exact position, appearance, and send time.

**How is this different from the Bilibili Video Scraper?**
The [Bilibili Video Scraper](https://apify.com/zen-studio/bilibili-video-scraper) returns the danmaku *count* per video as one engagement metric. This actor returns the individual danmaku *messages* themselves, one row each, with their timeline position and styling.

**How many danmaku will I get per video?**
Bilibili serves a rolling display pool per video, typically up to a few thousand depending on the video's length. This actor returns that current pool. Use `maxDanmaku` to cap it, or `startSec` / `endSec` to slice a window.

**Does it support multi-part videos?**
Yes. Every part (P1, P2, ...) is resolved, and each danmaku row carries its `partIndex` and `partTitle`.

**Do I need a Bilibili account or cookies?**
No. Provide video URLs or BV ids and run. No account, cookie export, or QR login is involved.

**How fresh is the data?**
Live. Every run fetches the current danmaku for each video at request time.

**How do I export the data?**
JSON, CSV, Excel, XML, or HTML from the run's Storage tab, or via the Apify API.

**What is a BV id, and where do I find it?**
The BV id is the unique code in a video's URL, for example `BV1DYjA6KEJ7` in `bilibili.com/video/BV1DYjA6KEJ7`. Paste either the full URL, the BV id, or the `av` number into `videoUrls`.

**Why is the sender shown as a hash?**
Bilibili identifies danmaku senders by an anonymized hash, not a username. The actor returns that hash as-is; it is not personally identifying on its own.

**What's the free tier?**
10 runs total per account, up to 100 danmaku each. No credit card required.

**Is it legal to scrape Bilibili data?**
This actor extracts only publicly available data, nothing behind a login. You are responsible for complying with Bilibili's terms of service and applicable data-protection law (GDPR, CCPA, and China's PIPL).

### Support

- **Bugs**: Issues tab
- **Features**: Issues tab

### Legal Compliance

Extracts publicly available data. Users must comply with Bilibili terms and data protection regulations (GDPR, CCPA, PIPL).

### More Zen Studio scrapers for Chinese platforms

**🎬 Short-video & social**

- **Bilibili 哔哩哔哩**
  - [Bilibili Video Scraper](https://apify.com/zen-studio/bilibili-video-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-3TJaaOJDU1AMiOoJM-Vu2eVr0P6N-douyin-profile-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **Douyin 抖音**
  - [Douyin Search Scraper](https://apify.com/zen-studio/douyin-search-scraper)
  - [Douyin Profile Scraper](https://apify.com/zen-studio/douyin-profile-scraper)
  - [Douyin Video Scraper](https://apify.com/zen-studio/douyin-video-scraper)
  - [Douyin Comments Scraper](https://apify.com/zen-studio/douyin-comments-scraper)
  - [Douyin Transcripts Scraper](https://apify.com/zen-studio/douyin-transcripts-scraper)
  - [Douyin Creator Rankings Scraper](https://apify.com/zen-studio/douyin-xingtu-rankings-scraper)
  - [Douyin Live Recorder](https://apify.com/zen-studio/douyin-live-recorder)
  - [Douyin Hot Search Scraper](https://apify.com/zen-studio/douyin-hot-search-scraper)
  - [Douyin Product Search Scraper](https://apify.com/zen-studio/douyin-product-search-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-mHKEEgoDqr6btQQer-fUs5ZquIeN-xiaohongshu-search-scraper-logo-square.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **RedNote 小红书**
  - [RedNote User Profile Scraper](https://apify.com/zen-studio/rednote-user-profile-scraper)
  - [RedNote Search Scraper](https://apify.com/zen-studio/rednote-search-scraper)
  - [RedNote Comments Scraper](https://apify.com/zen-studio/rednote-comments-scraper)
  - [RedNote Product Search Scraper](https://apify.com/zen-studio/rednote-product-search-scraper)
  - [RedNote Note Detail Scraper](https://apify.com/zen-studio/rednote-note-detail-scraper)
  - [RedNote Product Reviews Scraper](https://apify.com/zen-studio/rednote-product-reviews-scraper)
  - [RedNote Live Recorder](https://apify.com/zen-studio/rednote-live-recorder)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-dexCSKEZtKS8hg4fT-lD4weyiYga-shigua-____-scraper-logo.jpg" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **Xigua 西瓜视频**
  - [Xigua Video Search Scraper](https://apify.com/zen-studio/xigua-video-search-scraper)
  - [Xigua Video Detail Scraper](https://apify.com/zen-studio/xigua-video-detail-scraper)

**🛒 E-commerce**

- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-LwARSYSMWLBZfXfdr-FrDaNbQarB-shopee-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **Shopee**
  - [Shopee Product Detail Scraper](https://apify.com/zen-studio/shopee-product-detail-scraper)
  - [Shopee Product Reviews Scraper](https://apify.com/zen-studio/shopee-product-reviews-scraper)
  - [Shopee Product Scraper](https://apify.com/zen-studio/shopee-product-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-PsAKYWM55HG4AHXjK-ItywU7Bp0s-taobao-search-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **Taobao 淘宝**
  - [Taobao Search Scraper](https://apify.com/zen-studio/taobao-search-scraper)
  - [Taobao Product Detail Scraper](https://apify.com/zen-studio/taobao-detail-scraper)
  - [Taobao Seller Products Scraper](https://apify.com/zen-studio/taobao-seller-products-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-uZy6tbKLKnSVtT4BN-emXnT123uR-jd-com-scraper-logo-square.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **JD.com 京东**
  - [JD.com Search Scraper](https://apify.com/zen-studio/jd-com-search-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-ghXSMZcW3GxsCrkiR-5hnvsKv4Yt-1688-wholesale-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **1688 阿里巴巴**
  - [1688 Wholesale Scraper](https://apify.com/zen-studio/1688-wholesale-scraper)
  - [Alibaba Scraper](https://apify.com/zen-studio/alibaba-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-5QcLc4BHaLMBUKYs3-f3CWQ60Row-goofish-search-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **Goofish 闲鱼**
  - [Goofish (Xianyu) Search Scraper](https://apify.com/zen-studio/goofish-xianyu-search-scraper)
  - [Goofish (Xianyu) Seller Scraper](https://apify.com/zen-studio/goofish-xianyu-seller-scraper)
  - [Goofish (Xianyu) Item Detail Scraper](https://apify.com/zen-studio/goofish-xianyu-item-detail-scraper)
  - [Goofish (Xianyu) Item Comments & Q\&A Scraper](https://apify.com/zen-studio/goofish-xianyu-item-comments-scraper)

**🏠 Real estate & autos**

- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-1tAzNSf8Kz0v7Q2Lr-AINJ7FsZVU-anjuke-scraper-logo.jpg" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **Anjuke 安居客**
  - [Anjuke For-Sale Listings Scraper](https://apify.com/zen-studio/anjuke-real-estate-scraper)
  - [Anjuke New-Home Scraper](https://apify.com/zen-studio/anjuke-new-home-scraper)
  - [Anjuke Rental Listings Scraper](https://apify.com/zen-studio/anjuke-rent-scraper)
  - [Anjuke Listing Detail Scraper](https://apify.com/zen-studio/anjuke-sale-detail-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-32OkWqsiUywoq2ci3-7JhFlW1qg3-58__-real-estate-scraper-logo.jpg" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **58.com 58同城**
  - [58.com Real Estate Scraper](https://apify.com/zen-studio/58-real-estate-scraper)
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/NWYsOG96fMDy8ycdf-actor-ytaE4YpSmjXDmibPv-L1UMPHa2bO-che168-autohome-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **Autohome 汽车之家**
  - [Autohome (Che168) Used-Car Scraper](https://apify.com/zen-studio/che168-car-scraper)

***

*Scrape Bilibili (哔哩哔哩) danmaku (bullet comments) by video URL or BV id, with each comment's timeline position, color, mode, send time, and sender in structured JSON.*

# Actor input Schema

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

One or more Bilibili videos. Accepts a full <code>bilibili.com/video/...</code> URL, a <code>BV</code> id, or an <code>av</code> number.

## `maxDanmaku` (type: `integer`):

Cap the danmaku returned per video. <code>0</code> = all available. When capped, the most relevant danmaku are kept.

## `startSec` (type: `integer`):

Optional. Only danmaku at or after this many seconds into the video.

## `endSec` (type: `integer`):

Optional. Only danmaku at or before this many seconds into the video. <code>0</code> = no upper limit.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.bilibili.com/video/BV1DYjA6KEJ7"
  ],
  "maxDanmaku": 0,
  "startSec": 0,
  "endSec": 0
}
```

# Actor output Schema

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

Dataset of danmaku, bullet comments from Bilibili videos.

# 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 = {
    "videoUrls": [
        "https://www.bilibili.com/video/BV1DYjA6KEJ7"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zen-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 = { "videoUrls": ["https://www.bilibili.com/video/BV1DYjA6KEJ7"] }

# Run the Actor and wait for it to finish
run = client.actor("zen-studio/bilibili-danmaku-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "videoUrls": [
    "https://www.bilibili.com/video/BV1DYjA6KEJ7"
  ]
}' |
apify call zen-studio/bilibili-danmaku-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=zen-studio/bilibili-danmaku-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bilibili (哔哩哔哩) Danmaku Scraper - Bullet Comments with Timeline",
        "description": "Extract Bilibili (哔哩哔哩) danmaku (bullet comments) by video URL or BV id: comment text, timeline position, color, mode, send time, and sender hash. Export to JSON, CSV, or Excel.",
        "version": "0.0",
        "x-build-id": "kRuNpdUinMdcRK3Bv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/zen-studio~bilibili-danmaku-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-zen-studio-bilibili-danmaku-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/zen-studio~bilibili-danmaku-scraper/runs": {
            "post": {
                "operationId": "runs-sync-zen-studio-bilibili-danmaku-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/zen-studio~bilibili-danmaku-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-zen-studio-bilibili-danmaku-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "videoUrls"
                ],
                "properties": {
                    "videoUrls": {
                        "title": "🎞️ Video URLs or BV ids",
                        "type": "array",
                        "description": "One or more Bilibili videos. Accepts a full <code>bilibili.com/video/...</code> URL, a <code>BV</code> id, or an <code>av</code> number.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxDanmaku": {
                        "title": "Max danmaku per video",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Cap the danmaku returned per video. <code>0</code> = all available. When capped, the most relevant danmaku are kept.",
                        "default": 0
                    },
                    "startSec": {
                        "title": "Start time (seconds)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Optional. Only danmaku at or after this many seconds into the video.",
                        "default": 0
                    },
                    "endSec": {
                        "title": "End time (seconds)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Optional. Only danmaku at or before this many seconds into the video. <code>0</code> = no upper limit.",
                        "default": 0
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
