# Bilibili Comments & Danmaku Scraper - B站 评论/弹幕 (`seemuapps/bilibili-comments-danmaku-scraper`) Actor

Scrape Bilibili (哔哩哔哩) video comments, replies and danmaku bullet comments with likes, timestamps and user levels, plus each video's views, likes and coins.

- **URL**: https://apify.com/seemuapps/bilibili-comments-danmaku-scraper.md
- **Developed by:** [Seemu Scraping](https://apify.com/seemuapps) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 93.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 comments

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 Comments & Danmaku Scraper - B站 评论/弹幕

Export the comments, replies and danmaku (弹幕, the bullet comments that fly across the video) of any Bilibili (哔哩哔哩) video, without a login. Every run also returns the video's views, likes, coins, favorites and shares. Export to JSON, CSV, Excel or Google Sheets.

### What you get

**One summary row per video** (`rowType: "video"`): title, description, cover, publish date, duration, tags, views, likes, coins, favorites, shares, comment and danmaku totals, and the uploader's name, UID and follower count.

**Comments and replies** (`rowType: "comment"` / `"reply"`):

- Comment text, attached images, likes, reply count, post time and IP location (IP属地)
- Pinned flag, liked-by-uploader flag and whether the uploader wrote it
- Commenter name, UID, profile URL, avatar, account level (Lv0–6) and 大会员 VIP status
- Replies carry the ID of the comment they answer, so threads can be rebuilt

**Danmaku** (`rowType: "danmaku"`):

- Danmaku text and the second of the video it appears at
- When it was sent, display mode (scroll / top / bottom), color and font size
- An anonymous sender hash, so you can count unique senders

### Use cases

- **Audience sentiment analysis**: see what viewers say in comments and how they react moment by moment in danmaku
- **Content and highlight research**: find the exact seconds of a video that get the most danmaku
- **Brand and campaign monitoring**: collect reactions to sponsored videos and product placements on Bilibili
- **Influencer vetting**: check comment quality, engagement and real audience reaction before working with an UP主
- **Market research on Chinese Gen Z**: gather real opinions on games, anime, tech and consumer brands

### How to use

1. Paste one or more **Videos**: `https://www.bilibili.com/video/BV…` URLs, `b23.tv` share links, BV ids or av ids
2. Set **Max comments per video** (most popular first; 0 = none)
3. Optionally turn on **Include replies** and set **Max replies per comment**
4. Keep **Include danmaku** on and set **Max danmaku per video** (0 = everything Bilibili returns)
5. Run the actor and open the **Dataset** tab; the Comments, Danmaku and Videos views split the row types

### Output example

```json
{
  "rowType": "comment",
  "commentId": "3760801399",
  "videoId": "BV1GJ411x7h7",
  "text": "坏消息：被骗了\n好消息：真好听",
  "likes": 775532,
  "replyCount": 2279,
  "createdAt": "2020-11-29T12:26:45.000Z",
  "ipLocation": null,
  "isPinned": false,
  "authorName": "老咸鱼A",
  "authorId": "320773657",
  "authorUrl": "https://space.bilibili.com/320773657",
  "authorLevel": 6,
  "authorIsVip": false
}
```

```json
{
  "rowType": "danmaku",
  "danmakuId": "45399252391690247",
  "videoId": "BV1GJ411x7h7",
  "part": 1,
  "text": "《哥 斯 拉 大 战 金 刚 秘 密 片 段》",
  "videoTimeSeconds": 0,
  "sentAt": "2021-02-19T11:32:56.000Z",
  "displayMode": "top",
  "color": "#ffffff",
  "fontSize": 25,
  "senderHash": "8c4702e5"
}
```

### FAQ

**Do I need a Bilibili account?** No.

**How many danmaku can I get?** Bilibili serves the most recent ~1,000 danmaku of each video part (a multi-part video gives that much per part). Older danmaku beyond that pool aren't available.

**Which comments come first?** Bilibili's popular order (热门评论), with pinned comments at the top.

**Why is ipLocation empty on some comments?** Bilibili only shows IP location on comments posted since mid-2022.

# Actor input Schema

## `videos` (type: `array`):

Bilibili video URLs (https://www.bilibili.com/video/BV…), b23.tv share links, BV ids or av ids. One per line.

## `maxCommentsPerVideo` (type: `integer`):

How many top-level comments to collect per video, most popular first (pinned comments included). 0 = no comments.

## `includeReplies` (type: `boolean`):

Also collect the replies under each comment. Replies are separate rows with rowType = reply and the parent comment's ID.

## `maxRepliesPerComment` (type: `integer`):

Only used when Include replies is on.

## `includeDanmaku` (type: `boolean`):

Also collect the video's bullet comments (danmaku): text, the second of the video they appear at, send time, color and display mode. Bilibili serves the most recent ~1,000 danmaku per video part.

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

Cap on danmaku rows per video, across all of its parts. 0 = everything Bilibili returns.

## Actor input object example

```json
{
  "videos": [
    "https://www.bilibili.com/video/BV1GJ411x7h7"
  ],
  "maxCommentsPerVideo": 100,
  "includeReplies": false,
  "maxRepliesPerComment": 10,
  "includeDanmaku": true,
  "maxDanmakuPerVideo": 500
}
```

# Actor output Schema

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

Video rows (rowType video) with stats; comment and reply rows (rowType comment / reply) with text, likes, time and commenter; danmaku rows (rowType danmaku) with text, video timestamp and send time.

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

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

# Run the Actor and wait for it to finish
run = client.actor("seemuapps/bilibili-comments-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 '{
  "videos": [
    "https://www.bilibili.com/video/BV1GJ411x7h7"
  ]
}' |
apify call seemuapps/bilibili-comments-danmaku-scraper --silent --output-dataset

```

## MCP server setup

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