# Bilibili Scraper — Videos, Creators, Comments & Danmaku (`craplarp/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩, B站) without login: keyword search, video stats, tags, creator profiles with followers and uploads, trending & ranking boards, top comments with replies and danmaku bullet comments with a per-minute reaction curve. Clean English JSON/CSV/Excel.

- **URL**: https://apify.com/craplarp/bilibili-scraper.md
- **Developed by:** [Jahongir](https://apify.com/craplarp) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 videos

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 Scraper — Videos, Creators, Comments & Danmaku (哔哩哔哩 / B站)

Scrape **Bilibili**, China's largest video community, **without login or cookies**. Search videos by keyword, pull full video stats, creator (UP主) profiles with followers and uploads, the trending and ranking boards, top comments with replies, and **danmaku (弹幕) bullet comments with a per-minute reaction curve**.

Clean **English field names**, ISO dates, `https` image links and both Chinese and English category names: ready for Excel, Google Sheets, BI tools or an AI agent.

**From $1.50 per 1,000 videos.** You only pay for results.

### What you can scrape

| Source | What you get |
|---|---|
| 🔎 **Keyword search** | Up to 1,000 videos per keyword. Sort by relevance, views, newest, danmaku or favorites, and filter by duration |
| 🎬 **Video URLs / IDs** | BV / av IDs, `bilibili.com/video/...`, `m.bilibili.com` and `b23.tv` short links |
| 👤 **Creators (UP主)** | Profile: followers, following, total likes, video count, level, verification. Plus their latest uploads |
| 🔥 **Trending** | 综合热门 (popular now) or 排行榜 (top-100 ranking) |
| 💬 **Comments** | Top (hot) comments with likes, reply counts and author level. Optionally the replies under them |
| 📺 **Danmaku** | Bullet comments with time-in-video, text, colour, position and send date. Also a **per-minute reaction curve**, the **peak minute** and the **top repeated phrases** |

#### Video fields

`bvid, aid, url, title, description, coverUrl, publishedAt, durationSeconds, partsCount, category, categoryEn, isOriginal, tags, creatorMid, creatorName, creatorUrl, viewCount, likeCount, coinCount, favoriteCount, shareCount, danmakuCount, commentCount, engagementRate, highestRank, width, height, source`

`engagementRate` = (likes + coins + favorites + shares) / views.

### Use cases

- **Brand & market research in China**: see what Chinese audiences say about your product, game or category
- **Influencer (KOL) discovery**: rank creators by followers and engagement before a campaign
- **Content trend tracking**: schedule the trending board daily and see what goes viral
- **Video moment analysis**: the danmaku curve shows the exact minute viewers reacted most
- **AI / LLM datasets & agents**: structured Chinese video metadata and comments. Works through Apify's MCP server

### Example output

```json
{
  "type": "video",
  "bvid": "BV1MR436JETw",
  "url": "https://www.bilibili.com/video/BV1MR436JETw",
  "title": "为什么人工智能将在2030年前改变世界？",
  "publishedAt": "2026-11-03T13:40:30+00:00",
  "durationSeconds": 933,
  "category": "计算机技术",
  "categoryEn": "Tech",
  "tags": ["人工智能", "机器人", "AI安全", "自动驾驶"],
  "creatorName": "技术Flow",
  "creatorUrl": "https://space.bilibili.com/392208938",
  "viewCount": 3509,
  "likeCount": 94,
  "coinCount": 20,
  "favoriteCount": 86,
  "shareCount": 12,
  "danmakuCount": 2,
  "commentCount": 28,
  "engagementRate": 0.06042,
  "source": { "kind": "search", "query": "人工智能", "position": 1 }
}
```

A danmaku item:

```json
{
  "type": "danmaku",
  "videoBvid": "BV1EWxd6sExz",
  "danmakuAvailable": 211,
  "peakMinute": 0,
  "perMinute": [163, 43, 5],
  "topPhrases": [{ "text": "哈哈哈哈", "count": 3 }, { "text": "没绷住", "count": 2 }],
  "danmaku": [{ "timeSeconds": 0.67, "text": "…", "mode": "scroll", "color": "#ffffff", "sentAt": "2026-11-05T11:19:55+00:00" }]
}
```

Every item has a `type` (`video`, `creator`, `comment`, `danmaku`). Use the **Videos / Creators / Comments** views in the dataset tab, or filter by `type` when you export.

### Pricing (pay per event)

| Event | Price |
|---|---|
| Video | **$1.50 / 1,000** |
| Comment or reply | $0.50 / 1,000 |
| Creator profile | $2.00 / 1,000 |
| Danmaku pack (all danmaku + reaction curve for one video) | $3.00 / 1,000 videos |

Example: 1,000 videos with their top 20 comments and danmaku packs comes to $1.50 + $10.00 + $3.00 = **$14.50**.

Set **Max cost per run** in the run options and the scraper stops exactly at your budget.

### Tips

- **Speed vs depth:** turn off *Full video details* when you only need titles, views and danmaku counts from search results. It's roughly 2× faster.
- **Chinese keywords** find far more than English ones (`人工智能` rather than `artificial intelligence`).
- If the log shows many *risk control* retries, switch the proxy to **Residential** or lower *Max concurrency*.

### Limitations (honest list)

- Bilibili shows anonymous visitors only the **top ~20 comments** of a video, plus their replies. Full comment history needs a logged-in account, and this scraper never logs in.
- Search returns at most **1,000 results per keyword** (a Bilibili limit). Split broad topics into several keywords.
- AI subtitles/transcripts need login and are not included.
- Only public data is collected. The scraper does not bypass captchas or access anything behind a login.

### Legal

This Actor collects publicly available data. Comments and creator profiles include usernames, which can be personal data under laws such as GDPR. Make sure you have a legitimate purpose, keep only what you need, and respect Bilibili's terms. If unsure, ask a lawyer.

### Support

Found a bug or need a field? Open an issue on the **Issues** tab. Fixes usually ship within 48 hours.

# Actor input Schema

## `searchQueries` (type: `array`):

Keywords to search videos for. Chinese works best (e.g. 原神, 人工智能), but English and other languages are supported.

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

Video links (bilibili.com/video/BV..., b23.tv short links, m.bilibili.com) or bare IDs like BV1xx411c7mD / av170001.

## `creatorUrls` (type: `array`):

Creator space links (space.bilibili.com/123456) or numeric user IDs (mid). Returns the creator profile and their latest uploads.

## `trending` (type: `string`):

Also scrape a trending board: 'popular' (综合热门, updated continuously) or 'ranking' (排行榜, top 100).

## `maxItemsPerSource` (type: `integer`):

Maximum videos per search keyword, per creator, or from the trending board. Bilibili search returns at most 1000 results per keyword.

## `searchSort` (type: `string`):

How search results are sorted.

## `searchDuration` (type: `string`):

Filter search results by video length.

## `fetchVideoDetails` (type: `boolean`):

For search/creator/trending results, fetch the full video page data: likes, coins, favorites, shares, comment count, tags, category. Turn off for faster, lighter results (views, danmaku and basic info only).

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

Add the video's top (hot) comments as separate items with type 'comment'. Bilibili shows anonymous visitors roughly the top 20 comments per video.

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

Maximum top-level comments per video (Bilibili shows anonymous visitors about the top 20).

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

Also fetch replies under each top comment (type 'comment' with a parentCommentId).

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

Maximum replies fetched under each top comment.

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

Add one 'danmaku' item per video with the bullet comments (time in video, text, colour, sent date) plus a per-minute reaction curve and the peak minute.

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

Bilibili serves up to ~1000–8000 recent danmaku per video depending on its length.

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

Datacenter proxy works for most runs. Switch to residential if you see many 'risk control' retries.

## `maxConcurrency` (type: `integer`):

Parallel requests. Higher is faster but increases the chance of Bilibili rate limiting.

## Actor input object example

```json
{
  "searchQueries": [
    "人工智能"
  ],
  "trending": "none",
  "maxItemsPerSource": 20,
  "searchSort": "totalrank",
  "searchDuration": "0",
  "fetchVideoDetails": true,
  "includeComments": false,
  "maxCommentsPerVideo": 20,
  "includeReplies": false,
  "maxRepliesPerComment": 10,
  "includeDanmaku": false,
  "maxDanmakuPerVideo": 1000,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "maxConcurrency": 3
}
```

# Actor output Schema

## `videos` (type: `string`):

Video records with stats, tags and creator info.

## `creators` (type: `string`):

Creator (UP主) profiles with followers and likes.

## `comments` (type: `string`):

Top comments and replies.

## `allResults` (type: `string`):

Every item, including danmaku packs (filter by the `type` field).

# 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 = {
    "searchQueries": [
        "人工智能"
    ],
    "maxItemsPerSource": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("craplarp/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 = {
    "searchQueries": ["人工智能"],
    "maxItemsPerSource": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("craplarp/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 '{
  "searchQueries": [
    "人工智能"
  ],
  "maxItemsPerSource": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call craplarp/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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