# Bilibili Scraper (`fieldwright/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩, B站) without login: video search, video details and stats, comments, danmaku (弹幕), creator profiles and uploads, and the ranking board. Fast, no browser, pay per record.

- **URL**: https://apify.com/fieldwright/bilibili-scraper.md
- **Developed by:** [Fieldwright Data](https://apify.com/fieldwright) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

Collect public data from [Bilibili](https://www.bilibili.com) (哔哩哔哩, B站), China's largest video community: search results, video details and statistics, comments, danmaku (弹幕, the comments that scroll across the video), creator profiles and uploads, and the site-wide ranking board.

No login, no cookies, and no browser. Runs on plain datacenter proxies, so it is fast and cheap to run.

### What you can collect

| Input | You get |
| --- | --- |
| Search keywords | Videos matching each keyword, sorted the way you choose |
| Video URLs or BV IDs | Full details and statistics for each video |
| Creator IDs or space URLs | The creator's profile and their latest uploads |
| Ranking board | The current top 100 videos on Bilibili |
| Comments (optional) | Top-level comments for every video in the run |
| Danmaku (optional) | Every danmaku line of each video, with its position on the timeline |

You can combine inputs in one run. For example: search a brand name, and collect comments and danmaku for every video found.

### Typical uses

- **Brand and product monitoring in China.** Search your brand, then read what viewers say in comments and danmaku.
- **Creator research.** Follower counts, total likes, upload cadence and per-video performance for any creator.
- **Trend tracking.** Schedule the ranking board or a keyword search and compare runs over time.
- **Datasets for analysis and AI.** Chinese-language comments and danmaku with timestamps.

### Input example

```json
{
  "searchQueries": ["新能源汽车", "Nike"],
  "searchOrder": "click",
  "maxResultsPerQuery": 60,
  "maxCommentsPerVideo": 40,
  "includeDanmaku": true
}
```

Tips:

- Chinese keywords find far more than English ones. Search `耐克` as well as `Nike`.
- Bilibili itself returns at most about 1,000 videos per keyword.
- A creator ID is the number in `https://space.bilibili.com/208259`.

### Output

Every record has a `type`: `video`, `creator`, `comment` or `danmaku`.

#### Video

```json
{
  "type": "video",
  "source": "search",
  "query": "iPhone 评测",
  "bvid": "BV1eRaN6XEHT",
  "url": "https://www.bilibili.com/video/BV1eRaN6XEHT",
  "title": "九月份全价位iPhone红黑榜选购指南！",
  "description": "本期涵盖所有iPhone，一期告诉你哪些值得买，哪些不推荐！",
  "coverUrl": "https://i1.hdslb.com/bfs/archive/708fac2eb20592915d18b2cae710d5a673082429.jpg",
  "durationSeconds": 914,
  "publishedAt": "2026-10-01T10:30:00.000Z",
  "category": "数码",
  "tags": ["手机", "Apple", "iPhone"],
  "author": { "id": 627040687, "name": "荐机行事", "url": "https://space.bilibili.com/627040687" },
  "stats": { "views": 141488, "likes": 1130, "favorites": 2051, "comments": 80, "danmaku": 7 }
}
```

Videos requested by URL and ranking videos also include `coins`, `shares`, `isOriginal` and, for the ranking board, `rank`.

#### Creator

```json
{
  "type": "creator",
  "id": 208259,
  "url": "https://space.bilibili.com/208259",
  "name": "陈睿",
  "bio": "喜欢的话就坚持吧",
  "level": 6,
  "verified": true,
  "verifiedTitle": "bilibili董事长兼CEO",
  "followers": 2298702,
  "following": 550,
  "videoCount": 17,
  "totalLikes": 6328219
}
```

#### Comment

```json
{
  "type": "comment",
  "videoBvid": "BV1eRaN6XEHT",
  "videoUrl": "https://www.bilibili.com/video/BV1eRaN6XEHT",
  "commentId": "320527950016",
  "text": "转转一说出来，我就不用想了",
  "likes": 40,
  "replyCount": 0,
  "postedAt": "2026-10-12T18:28:39.000Z",
  "author": { "id": 1312368514, "name": "悍匪强森", "level": 5 }
}
```

#### Danmaku

One record per video. `atSeconds` is where the line appears on the video timeline.

```json
{
  "type": "danmaku",
  "videoBvid": "BV1eRaN6XEHT",
  "count": 7,
  "items": [
    { "atSeconds": 384.967, "text": "手持4年了", "sentAt": "2026-10-03T09:17:23.000Z", "mode": 1, "color": "#ffffff" }
  ]
}
```

### Limits to know about

- **Comments are top-level only.** Replies under a comment are not collected yet; `replyCount` tells you how many there are.
- **Comments are sorted by popularity**, as Bilibili shows them to visitors.
- **Subtitles are not included.** Bilibili only serves them to logged-in users.
- **Danmaku is the set Bilibili serves for the video's first part**, up to several thousand lines for popular videos.

### Speed and cost

A run that collected 120 videos, 4,566 comments and 120 danmaku records finished in under five minutes. You pay per record collected; set a maximum cost per run in the run options and the Actor stops when it is reached.

### Is this legal?

The Actor reads only data that Bilibili shows publicly to visitors who are not logged in. Comments and danmaku can contain personal data, so make sure your use has a lawful basis under the rules that apply to you (for example GDPR or PIPL).

### Feedback

Found a bug or need a field that is missing? Open an issue on the Issues tab and it will be looked at quickly.

# Actor input Schema

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

Keywords to search on Bilibili. Chinese keywords return the most results.

## `searchOrder` (type: `string`):

How search results are sorted.

## `maxResultsPerQuery` (type: `integer`):

Bilibili returns at most about 1,000 videos per keyword.

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

Video links (https://www.bilibili.com/video/BV...) or bare BV IDs. Each returns full details and statistics.

## `creatorIds` (type: `array`):

Creator UIDs (for example 208259) or links (https://space.bilibili.com/208259). Returns the profile and the creator's uploads.

## `maxVideosPerCreator` (type: `integer`):

How many of each creator's latest uploads to return. Set 0 for the profile only.

## `includeRanking` (type: `boolean`):

Adds the current top 100 ranking videos.

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

Top-level comments to collect for every video in the output. 0 turns comments off.

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

Adds one record per video with its danmaku: text, position in the video and send time.

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

Datacenter proxies are enough for Bilibili.

## Actor input object example

```json
{
  "searchQueries": [
    "iPhone 评测"
  ],
  "searchOrder": "totalrank",
  "maxResultsPerQuery": 40,
  "maxVideosPerCreator": 30,
  "includeRanking": false,
  "maxCommentsPerVideo": 0,
  "includeDanmaku": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Videos, creators, comments and danmaku collected by the run.

# 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": [
        "iPhone 评测"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("fieldwright/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": ["iPhone 评测"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("fieldwright/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": [
    "iPhone 评测"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call fieldwright/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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