# Bilibili Scraper | 哔哩哔哩数据采集 (`fetchfinch/bilibili-scraper`) Actor

\[ 💰 $18 / 1K] Scrape Bilibili videos, comments, danmaku, creator profiles, and uploads. 抓取哔哩哔哩视频、评论、弹幕及UP主资料。

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

## Pricing

from $18.00 / 1,000 bilibili records

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

### Turn Bilibili activity into usable data

![No Bilibili login](https://img.shields.io/badge/Bilibili%20login-not%20required-43A047)
![Collection](https://img.shields.io/badge/Collection-direct%20HTTP-3178C6)
![Pricing](https://img.shields.io/badge/Pricing-%2418%20per%201%2C000%20rows-5C6BC0)
![Modes](https://img.shields.io/badge/Modes-6-5C6BC0)
![Results](https://img.shields.io/badge/Results-videos%20%7C%20creators%20%7C%20comments%20%7C%20danmaku-00A98F)
![Export](https://img.shields.io/badge/Export-JSON%20%7C%20CSV%20%7C%20Excel-F39C12)

Find videos, research creators, read audience comments, and measure danmaku activity from **Bilibili (哔哩哔哩)**. Enter a keyword, BV ID, or creator MID and run the Actor. Results go to an Apify dataset that you can inspect or export. No Bilibili account, browser, proxy configuration, or third-party API key is required.

Use it to follow a creator's uploads, discover videos about a topic, compare engagement, or collect comments for audience research. The Actor also supports repeat runs that return only newly seen search or popular videos.

### What can you collect?

| Mode | Give it | Get back | Useful for |
| --- | --- | --- | --- |
| search | A keyword and optional related terms | Video titles, links, creators, dates, engagement counts | Content discovery and campaign research |
| video_detail | BV IDs or video URLs | Detailed video records, with optional comments and danmaku profiles | Video and campaign analysis |
| video_comments | BV IDs or video URLs | Comments and optional thread replies | Audience feedback research |
| user_videos | Creator MIDs or profile URLs | A creator profile and discovered uploads | Creator monitoring and benchmarking |
| user_profile | Creator MIDs or profile URLs | Followers, following, bio, level, verification, video count | Creator shortlists |
| popular | An optional category | Popular videos and their engagement counts | Trend spotting |

**includeComments** and **includeDanmaku** can enrich video results. Each row has a **type** value (video, user, comment, or danmaku) so you can separate the records after export. **maxResults** limits primary video or profile results; **maxComments** limits comments **per video**.

### Examples you can use now

Copy an input into the Actor's JSON input editor, or choose the same fields in the form. These examples use real Bilibili identifiers; results and engagement counts change over time.

#### Discover AI tutorial videos across related searches

Find videos mentioning Chinese AI tutorial terms. The Actor deduplicates BV IDs found by more than one search term.

```json
{
  "mode": "search",
  "searchQuery": "人工智能教程",
  "searchAliases": ["AI教程", "机器学习入门"],
  "sortOrder": "pubdate",
  "maxResults": 50
}
```

For larger historical research jobs, set **maxResults** above 1,000. The Actor splits search into publication-date windows to get past Bilibili's roughly 1,000-result limit per window. Very busy single days can still be capped.

#### Follow a creator's uploads

Collect a profile and up to 30 discovered videos from creator MID **546195** (老番茄). Each upload includes **discoverySource**, showing whether it came from the archive, creator-space listing, or search fallback.

```json
{
  "mode": "user_videos",
  "userIds": ["546195"],
  "maxResults": 30
}
```

If you only need creator facts for a shortlist, switch to **user_profile** and pass several MIDs in **userIds**.

#### Compare video engagement and danmaku activity

Get video metrics, up to 20 comments, and a danmaku activity profile for a real Bilibili video. The danmaku row includes the fetched count, unique sender count, rate, peak minute, and a small timeline sample.

```json
{
  "mode": "video_detail",
  "videoUrls": ["https://www.bilibili.com/video/BV1VCHY6BEcn"],
  "maxResults": 1,
  "includeComments": true,
  "maxComments": 20,
  "includeDanmaku": true
}
```

#### Read a video's comment threads

Use the dedicated comments mode when you want feedback rather than a video record. **includeReplies** brings in thread replies within the per-video comment limit.

```json
{
  "mode": "video_comments",
  "videoUrls": ["BV1VCHY6BEcn"],
  "maxComments": 100,
  "sortComments": "time",
  "includeReplies": true
}
```

#### Watch technology trends without repeating old results

Run this input regularly to collect newly seen popular technology videos. **deltaMode** keeps the seen BV IDs in a named Apify key-value store for this Actor, so later runs with the same settings return new matches.

```json
{
  "mode": "popular",
  "category": "tech",
  "maxResults": 30,
  "deltaMode": true,
  "deltaStateKey": "tech-trends"
}
```

### What does the output look like?

| Row type | Selected fields | What it tells you |
| --- | --- | --- |
| video | bvid, title, url, authorName, authorMid, publishDate, viewCount, likeCount, danmakuCount | Video identity, creator, timing, and engagement |
| user | mid, name, profileUrl, followers, following, videoCount, totalLikes, sign | Creator profile and reach |
| comment | commentId, text, authorName, likeCount, createdAt, videoBvid, rootRpid | Audience feedback and thread context |
| danmaku | videoBvid, danmakuFetched, danmakuUniqueSenders, danmakuPeakMinute, danmakuSample | Aggregate activity across the fetched danmaku pool |

For example, a successful run on 3 October 2026 returned these **selected fields** for the video above. Counts are a snapshot, not live values:

```json
[
  {
    "type": "video",
    "bvid": "BV1VCHY6BEcn",
    "title": "我记得课本里的新疆，不是这样的啊？？",
    "viewCount": 483992,
    "likeCount": 25285
  },
  {
    "type": "danmaku",
    "videoBvid": "BV1VCHY6BEcn",
    "danmakuFetched": 1068,
    "danmakuUniqueSenders": 766,
    "danmakuPeakMinute": 0
  }
]
```

Open the run's **Output** tab to inspect the dataset, or export it as JSON, CSV, or Excel. The dataset also has an output schema for integrations and a table view for quick inspection.

### How much does it cost?

| Charge | Price | When it applies |
| --- | --- | --- |
| Bilibili record | $0.018 per dataset row ($18 per 1,000) | Each video, creator profile, comment, or danmaku profile row saved |
| Actor start | $0.00005 | When a run starts at the default 1 GB memory |
| Platform usage | Included | No separate compute or proxy charge from this Actor |

For example, 100 video rows cost $1.80 plus the start charge. Adding one danmaku profile adds one row at the same $0.018 rate. You only pay the row charge for records the Actor saves to the dataset.

### How does the Actor handle Bilibili limits?

| Situation | Behavior |
| --- | --- |
| A search window reaches roughly 1,000 results | For deep searches, split it into smaller publication-date windows and deduplicate BV IDs. |
| A creator upload endpoint blocks pagination | Try the signed creator-space listing, then exact-MID search results. **discoverySource** identifies each recovered video's path. |
| A video has many comments | Stop at **maxComments** per video; optionally include thread replies. |
| A video has a large danmaku history | Return a profile of the fetched pool. Danmaku enrichment is limited to 200 videos per run. |
| A repeated search or popular run sees old videos | With **deltaMode**, omit BV IDs recorded by earlier runs with the same settings. |

Creator upload listings can be restricted by Bilibili. A requested count is a maximum, and a run may return fewer uploads than requested. Search fallback is exact-MID filtered, but it is not a guarantee of complete upload history. The run log reports listing failures and shortfalls. The danmaku row summarizes the fetched pool; it does not contain every individual danmaku message.

### Questions

**Do I need a Bilibili login or API key?** No. The Actor reads public responses over HTTP.

**Can I monitor more than one topic?** Yes. Create a separate saved task for each topic or category. For repeat runs, use a distinct **deltaStateKey** where you want separate monitoring histories.

**Can I use the results in another tool?** Yes. Export the dataset or read it through Apify's dataset API. Every row includes **type** and **scrapedAt** for downstream filtering.

**Why did a run return fewer records than requested?** Bilibili may return fewer matching results, cap a search window, or restrict a creator listing. Check the run log for coverage notes and endpoint errors; delivered rows remain in the dataset.

# Actor input Schema

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

What to collect.

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

Keyword for search mode.

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

Extra keywords to search and deduplicate with the main query.

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

Video IDs or full Bilibili video URLs.

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

Numeric mids, UID:mid, or space.bilibili.com/mid links.

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

Maximum primary rows in this run.

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

Maximum comment rows per video, including thread replies.

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

Order for video search.

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

Hot, newest, or likes across the fetched comments.

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

Filter video length on Bilibili search.

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

ISO date or date-time, inclusive. A bare date means 00:00 UTC.

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

ISO date or date-time, inclusive. A bare date means 00:00 UTC.

## `category` (type: `string`):

Filter popular videos by Bilibili main or sub-zone name.

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

Fetch comments for each video row.

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

Fetch inline and paged replies within maxComments.

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

Add one aggregate danmaku row per video, up to 200 videos.

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

Number of evenly spaced comments to include in the profile.

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

For search and popular, persist seen BV IDs in the Actor key-value store.

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

Use a unique key for each scheduled monitor.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "人工智能教程",
  "videoUrls": [
    "https://www.bilibili.com/video/BV1VCHY6BEcn"
  ],
  "userIds": [
    "546195"
  ],
  "maxResults": 50,
  "maxComments": 20,
  "sortOrder": "totalrank",
  "sortComments": "hot",
  "durationFilter": "any",
  "category": "all",
  "includeComments": false,
  "includeReplies": false,
  "includeDanmaku": false,
  "danmakuSampleSize": 25,
  "deltaMode": false,
  "deltaStateKey": "default"
}
```

# Actor output Schema

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

All extracted Bilibili records. The row type is video, user, comment, or danmaku, depending on the selected mode and optional fan-outs.

# 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 = {
    "searchQuery": "人工智能教程"
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetchfinch/bilibili-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 = { "searchQuery": "人工智能教程" }

# Run the Actor and wait for it to finish
run = client.actor("fetchfinch/bilibili-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 '{
  "searchQuery": "人工智能教程"
}' |
apify call fetchfinch/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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