# Bilibili Scraper: Videos, Comments, Danmaku & Creators (`mrdoe/bilibili-scraper-videos-comments-danmaku`) Actor

Scrape Bilibili (哔哩哔哩): video search, video stats, comment threads, danmaku reaction profiles, creator profiles and the popular board. No login, no cookie.

- **URL**: https://apify.com/mrdoe/bilibili-scraper-videos-comments-danmaku.md
- **Developed by:** [MrDoe](https://apify.com/mrdoe) (community)
- **Categories:** Social media
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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: Videos, Comments, Danmaku & Creators - scrape data with Apify](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/bilibili-scraper-videos-comments-danmaku--hero.png)

### What does Bilibili Scraper: Videos, Comments, Danmaku & Creators do?

Bilibili Scraper collects data from **Bilibili (哔哩哔哩)**, China's biggest video community, without a login or cookie: **video search** (with sort, duration and date filters), **video details** (views, likes, coins, favorites, shares, danmaku and tags), **comment threads**, **danmaku reaction profiles** (the scrolling on-video comments Bilibili is known for), **creator profiles** (followers, likes, verification) and the **popular board**. Use it for Chinese consumer research, brand monitoring, influencer discovery and language datasets.

### Quick start (3 steps)

1. **Open the Actor** on Apify and click **Try for free**.
2. **Choose what you want** in the input form. The default searches a sample keyword and returns 20 videos. Press **Start**.
3. **Download the results** as JSON, CSV or Excel, connect them to Google Sheets, or call the Actor as a live API (see below).

### Where and how can you use it?

| Use case | Who it is for | How to do it |
|---|---|---|
| **Chinese brand and product monitoring** | Brands and agencies | Search a brand name (Chinese and English) on a schedule with "new videos only" turned on. |
| **Influencer (KOL) discovery and vetting** | Marketing teams | Search a niche, then run creator profiles to compare followers and total likes. |
| **Consumer sentiment research** | Analysts and investors | Collect comments on videos about a product, game or brand. |
| **Reaction analysis with danmaku** | Researchers and creators | Turn on danmaku profiles to see when the audience reacts, second by second. |
| **Trend tracking** | Content teams | Schedule the popular board to see what is trending each day. |
| **Language and AI datasets** | NLP and AI teams | Collect Chinese titles, descriptions and comments in bulk. |

**Works with:** Google Sheets, Excel, Make, Zapier, n8n, Airtable, Slack, Discord, Telegram, webhooks, Python, JavaScript, cURL and any AI agent that can call an HTTP API.

### What data do you get?

![Bilibili Scraper: Videos, Comments, Danmaku & Creators data fields](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/bilibili-scraper-videos-comments-danmaku--fields.png)

![Bilibili Scraper: Videos, Comments, Danmaku & Creators output data](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/bilibili-scraper-videos-comments-danmaku--output.png)

| Field | Meaning |
|---|---|
| `type` | video, comment, user or danmaku |
| `bvid, aid, title, description, url, thumbnailUrl` | Video identity and text |
| `viewCount, likeCount, coinCount, favoriteCount, shareCount, danmakuCount, replyCount` | Engagement (coins and shares come from video details and the popular board) |
| `authorName, authorMid, publishDate, category, tags` | Creator and publishing info |
| `text, likeCount, replyCount, authorName, createdAt` | Comment rows |
| `mid, name, fans, following, videoCount, totalLikes, level, isOfficial` | Creator profile rows |
| `danmakuFetched, danmakuTotal, danmakuUniqueSenders, danmakuPerMinute, danmakuPeakMinute, danmakuSample` | Danmaku reaction profile per video |

### Example result

```json
{
  "type": "video",
  "bvid": "BV1xx411c7mD",
  "title": "字幕君交流场所",
  "url": "https://www.bilibili.com/video/BV1xx411c7mD",
  "duration": 2055,
  "viewCount": 5519937,
  "likeCount": 276629,
  "coinCount": 40706,
  "favoriteCount": 127179,
  "danmakuCount": 128551,
  "replyCount": 89295,
  "authorMid": 2,
  "publishDate": "2009-06-26T00:00:00+00:00"
}
```

### Input parameters

![Bilibili Scraper: Videos, Comments, Danmaku & Creators input options](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/bilibili-scraper-videos-comments-danmaku--input.png)

| Parameter | Type | Default | What it does |
|---|---|---|---|
| `mode` | string | search | search, video_detail, video_comments, user_videos, user_profile or popular |
| `searchQuery` | string | - | Keyword in Chinese or English |
| `searchAliases` | array | \[] | Extra keywords to merge (for example a brand's Chinese name) |
| `autoLocalize` | boolean | true | Also searches the Chinese name of a common brand or game (Nike also searches 耐克) |
| `sentimentAnalysis` | boolean | false | Adds a sentiment field (positive / neutral / negative and a -1 to 1 score) to videos and comments |
| `includeReplies` | boolean | false | Returns replies under each comment as their own rows (`rootRpid`, `isThreadReply`) |
| `videoUrls` | array | \[] | Video links or BV ids |
| `userIds` | array | \[] | Creator ids (mid) or space.bilibili.com links |
| `maxResults` | integer | 20 | Videos or creators to return (up to 5000) |
| `sortOrder` | string | totalrank | totalrank, click, pubdate, dm, stow or scores |
| `durationFilter` | string | any | any, short, medium, long or verylong |
| `pubtimeBegin / pubtimeEnd` | string | - | Publish date range (UTC) |
| `includeComments` | boolean | false | Also return each video's comments |
| `maxComments` | integer | 20 | Comments per video |
| `includeDanmaku` | boolean | false | Add a danmaku reaction profile per video (up to 200 videos) |
| `deltaMode` | boolean | false | Return only videos not seen by earlier runs with the same key |
| `deltaStateKey` | string | default | Name of the saved state for delta mode |

### Input examples

**Search videos**

```json
{
  "mode": "search",
  "searchQuery": "人工智能教程",
  "maxResults": 50
}
```

**Newest videos about a brand**

```json
{
  "mode": "search",
  "searchQuery": "耐克",
  "sortOrder": "pubdate",
  "maxResults": 30
}
```

**Video details**

```json
{
  "mode": "video_detail",
  "videoUrls": [
    "https://www.bilibili.com/video/BV1xx411c7mD"
  ]
}
```

**Comments on a video**

```json
{
  "mode": "video_comments",
  "videoUrls": [
    "BV1xx411c7mD"
  ],
  "maxComments": 50
}
```

**Creator profiles**

```json
{
  "mode": "user_profile",
  "userIds": [
    "546195",
    "https://space.bilibili.com/456664753"
  ]
}
```

**Trending videos**

```json
{
  "mode": "popular",
  "maxResults": 20
}
```

### Use it as a live API (Actor Standby)

Need an answer right now instead of starting a run? This Actor also works as an **always-on HTTP endpoint** (Apify Actor Standby). Send a request, get JSON back in seconds.

```bash
curl -H "Authorization: Bearer $APIFY_TOKEN" \
  "https://mrdoe--bilibili-scraper-videos-comments-danmaku.apify.actor/?mode=search&searchQuery=人工智能教程&maxResults=10"
```

```python
import requests
r = requests.get(
    "https://mrdoe--bilibili-scraper-videos-comments-danmaku.apify.actor/",
    params={"mode": "search", "searchQuery": "人工智能教程", "maxResults": "10"},
    headers={"Authorization": "Bearer YOUR_APIFY_TOKEN"},
    timeout=90,
)
print(r.json()["items"])
```

```javascript
const res = await fetch("https://mrdoe--bilibili-scraper-videos-comments-danmaku.apify.actor/?mode=search&searchQuery=人工智能教程&maxResults=10", {
  headers: { Authorization: `Bearer ${process.env.APIFY_TOKEN}` },
});
const { count, items } = await res.json();
```

You can also `POST` a JSON body with the same fields as the Actor input. The response is `{ "count": 1, "items": [ ... ] }`; if something is wrong with your request you get a clear `error` message.

| | Standby API | Normal run |
|---|---|---|
| Best for | Apps, bots, chat assistants, quick lookups | Scheduled jobs, bigger exports, datasets |
| Output | JSON in the response | Dataset (JSON, CSV, Excel, XML) |
| Scheduling | Call it whenever you like | Apify Schedules and Tasks |

### Ready-made Tasks

Open the **Tasks** tab, pick a ready-made Task and press **Start**. Clone any Task to change the input and add a schedule.

### Tips for best results

- Chinese keywords return far more videos than English ones - add the Chinese name in `searchAliases`.
- A single search reaches about 1,000 videos; use `pubtimeBegin` and `pubtimeEnd` to go deeper by date range.
- Comments and danmaku profiles multiply the rows returned, so keep `maxComments` low and turn them on only when needed.
- Save a Task with `deltaMode` on and add a schedule to get only new videos each run.
- Use `user_profile` on a schedule to track a creator's follower growth.

### More features

- **Auto Chinese brand search:** searching a common Latin brand or game name also searches its Chinese name and merges the results.
- **Sentiment scoring:** every video and comment can carry `sentiment` (`polarity`, `score`, `method`). It uses a built-in word list, so treat it as a quick signal for ranking and trends.
- **Comment replies:** turn on `includeReplies` to get each reply as its own row, linked to its comment by `rootRpid`.

### Known limitations

- Bilibili returns about 1,000 results per search query.
- `user_videos` finds a creator's videos through search, so it is not a complete upload list.
- Some videos have comments closed and return none.
- Danmaku profiles cover the danmaku Bilibili keeps for a video, which can be fewer than its total; the profile says when the pool is capped.

### Frequently Asked Questions

#### Do I need a Bilibili account or cookie?

No. It works without any login or cookie.

#### What is danmaku (弹幕)?

The scrolling comments shown over Bilibili videos, tied to a specific second. The profile shows when and how strongly viewers reacted.

#### Can I search in English?

Yes, but Chinese keywords return more videos.

#### How do I find a creator id?

![How the Bilibili Scraper: Videos, Comments, Danmaku & Creators works](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/bilibili-scraper-videos-comments-danmaku--how-it-works.png)
It is the number in the creator's space link, for example space.bilibili.com/546195.

#### Can I use this Actor as an API?

Yes. Call the endpoint shown in **Use it as a live API** with your Apify token and read the JSON in the response.

#### Can I connect it to Google Sheets, Make, Zapier or n8n?

Yes. Use the Apify integrations for each tool, or call the endpoint from any HTTP module. Scheduled Tasks can push fresh data to your sheet or workflow.

#### Can I run it on a schedule?

Yes. Create a Task with your input and add a schedule in Apify Console.

#### Am I charged for failed runs or empty results?

You are charged only for records actually returned.

### Support

Questions or a missing field? Open an issue from the **Issues** tab on this Actor's page.

### Legal / Responsible Use

Data is collected from publicly available Bilibili pages for research and analytics. You are responsible for using it in line with applicable law, the platform's terms and data-protection rules, including for personal data in comments and profiles.

# Actor input Schema

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

search = videos by keyword, video_detail = full stats for video URLs, video_comments = comment threads, user_videos = a creator's videos, user_profile = creator stats, popular = the trending board.

## `searchQuery` (type: `string`):

Keyword in Chinese or English (search mode). Chinese keywords return the most videos.

## `searchAliases` (type: `array`):

More keywords to search and merge, for example the Chinese name of a brand.

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

Also searches the Chinese name of a common brand or game (for example Nike also searches 耐克) and merges the results. Add other names in Extra search terms.

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

Bilibili video links or BV ids (video_detail and video_comments).

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

Creator ids (mid), space.bilibili.com links or UID:<mid> (user_videos and user_profile).

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

Videos (or creators) to return, up to 5000. One search reaches about 1000 videos.

## `sortOrder` (type: `string`):

totalrank = relevance, click = most views, pubdate = newest, dm = most danmaku, stow = most favorites, scores = most comments.

## `durationFilter` (type: `string`):

any, short (under 10 min), medium (10-30), long (30-60) or verylong (over 60).

## `pubtimeBegin` (type: `string`):

YYYY-MM-DD or ISO date-time (UTC).

## `pubtimeEnd` (type: `string`):

YYYY-MM-DD or ISO date-time (UTC).

## `includeComments` (type: `boolean`):

Also return each video's comments as rows. Every comment is a billed row, so keep maxComments low.

## `maxComments` (type: `integer`):

Comments per video when comments are on.

## `sortComments` (type: `string`):

hot = top comments, time = newest, likes = most liked.

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

Returns replies under each comment as their own rows (with rootRpid and isThreadReply). They count toward Max comments per video.

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

Adds one reaction profile per video (up to 200 videos): count, unique senders, rate, peak minute and a timeline sample of the scrolling comments.

## `danmakuSampleSize` (type: `integer`):

How many danmaku texts to include in each profile.

## `sentimentAnalysis` (type: `boolean`):

Adds a sentiment field (positive, neutral or negative plus a score from -1 to 1) to videos and comments. Uses a built-in word list, so treat it as a quick signal.

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

Search and popular only: return only videos not returned by an earlier run with the same state key.

## `deltaStateKey` (type: `string`):

Name for the saved state when new-videos-only is on, for example nike-weekly.

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

Apify Proxy is on by default for reliable access. Change the country or group if you need to.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "人工智能教程",
  "searchAliases": [],
  "autoLocalize": true,
  "videoUrls": [],
  "userIds": [],
  "maxResults": 20,
  "sortOrder": "totalrank",
  "durationFilter": "any",
  "pubtimeBegin": "",
  "pubtimeEnd": "",
  "includeComments": false,
  "maxComments": 20,
  "sortComments": "hot",
  "includeReplies": false,
  "includeDanmaku": false,
  "danmakuSampleSize": 25,
  "sentimentAnalysis": false,
  "deltaMode": false,
  "deltaStateKey": "default",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (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 = {
    "mode": "search",
    "searchQuery": "人工智能教程",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("mrdoe/bilibili-scraper-videos-comments-danmaku").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 = {
    "mode": "search",
    "searchQuery": "人工智能教程",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("mrdoe/bilibili-scraper-videos-comments-danmaku").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 '{
  "mode": "search",
  "searchQuery": "人工智能教程",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call mrdoe/bilibili-scraper-videos-comments-danmaku --silent --output-dataset

```

## MCP server setup

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

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/DQyNV18p7I2LjEmC9/builds/Hl9JOogw0eI3tBm3D/openapi.json
