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

Scrape Bilibili (哔哩哔哩): search videos by keyword, get video statistics, creator profiles and uploads, popular and ranking lists, comments and danmaku. English field names. No login needed.

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

## Pricing

$3.00 / 1,000 results

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

Extract public data from [Bilibili](https://www.bilibili.com) (哔哩哔哩), China's largest video community with more than 300 million monthly users. Use it for brand monitoring in China, influencer research, trend tracking, market research and training data.

- **Eight kinds of data in one Actor.** Video search, video statistics, creator profiles, creator uploads, popular videos, the top 100 ranking, comments and danmaku.
- **English field names.** Output is clean JSON with names like `views`, `likes` and `publishedAt`, ready for spreadsheets and code. Text content stays in the original language.
- **No login and no proxy needed.** Press Start and get data.
- **Low price.** $3 per 1,000 results.

### What data can you get?

| Mode | One result is | Main fields |
|---|---|---|
| Search videos | One video | Title, views, likes, favorites, comments, danmaku count, tags, creator, publish date |
| Video details | One video | Everything above plus coins, shares, category and publish location |
| Creator uploads | One video | Title, views, comments, publish date for every upload of a creator |
| Creator profiles | One creator | Followers, total likes, video count, level, verification, bio |
| Popular videos | One video | The videos trending on Bilibili right now, with full statistics |
| Top 100 ranking | One video | The site-wide ranking, with rank and full statistics |
| Comments | One comment | Text, likes, reply count, author, author location, images |
| Danmaku | One on-screen comment | Text, the second of the video it appears at, send time, color |

Danmaku (弹幕) are the comments that fly across the video while it plays. Each one is tied to an exact second of the video, which shows what viewers reacted to and when.

### How to use it

1. Click **Try for free**.
2. Choose a mode in **What to scrape**.
3. Fill in the matching input: keywords, video URLs or creators.
4. Click **Start**, then download the results as JSON, CSV or Excel.

### Input examples

Search the newest videos about a brand:

```json
{
    "mode": "search",
    "searchQueries": ["耐克", "Nike"],
    "sortOrder": "pubdate",
    "maxItems": 200
}
```

Get full statistics for specific videos:

```json
{
    "mode": "videoDetails",
    "videoUrls": ["https://www.bilibili.com/video/BV1X4a36KEuH", "BV14Baa6JENd"]
}
```

Get every upload of a creator:

```json
{
    "mode": "userVideos",
    "userIds": ["https://space.bilibili.com/59905809"],
    "maxItems": 500
}
```

Get the danmaku of a video:

```json
{
    "mode": "danmaku",
    "videoUrls": ["BV1X4a36KEuH"],
    "maxItems": 5000
}
```

### Output examples

A video:

```json
{
    "type": "video",
    "bvid": "BV1X4a36KEuH",
    "aid": 117347717285664,
    "url": "https://www.bilibili.com/video/BV1X4a36KEuH",
    "title": "⚡️她连唐笑都在调上⚡️",
    "durationSeconds": 177,
    "publishedAt": "2026-09-28T09:00:00Z",
    "tags": ["手书", "鬼畜", "原神"],
    "authorId": 59905809,
    "authorName": "哦呼w",
    "authorUrl": "https://space.bilibili.com/59905809",
    "views": 883833,
    "likes": 75178,
    "coins": 13543,
    "favorites": 20400,
    "shares": 3852,
    "comments": 1770,
    "danmakuCount": 333,
    "scrapedAt": "2026-09-29T09:20:11Z"
}
```

A comment:

```json
{
    "type": "comment",
    "commentId": "315364562513",
    "videoBvid": "BV1X4a36KEuH",
    "isReply": false,
    "parentCommentId": null,
    "text": "这样真的能抓到二级号吗？",
    "likes": 320,
    "replyCount": 74,
    "publishedAt": "2026-09-28T13:30:53Z",
    "authorId": 3546929495541855,
    "authorName": "夜月三重奏",
    "authorLevel": 4
}
```

A danmaku:

```json
{
    "type": "danmaku",
    "videoBvid": "BV1X4a36KEuH",
    "text": "等会，你说在什么上？",
    "videoTimeSeconds": 12.4,
    "sentAt": "2026-09-28T09:43:42Z",
    "displayMode": "scroll",
    "color": "#ffffff"
}
```

### How much does it cost?

You pay per saved result: **$3.00 per 1,000 results**. There is no start fee and no monthly rental. Turning on **Add full statistics** does not change the price.

| Run | Results | Cost |
|---|---|---|
| 100 search results | 100 | $0.30 |
| All 355 uploads of one creator | 355 | $1.07 |
| 5,000 danmaku | 5,000 | $15.00 |

Set a maximum charge per run in the run options and the Actor stops when it is reached.

### Limits you should know

- **Search returns at most 1,000 videos per keyword.** This is Bilibili's own limit. To get more, use several related keywords or different sort orders.
- **Comments are limited to the top and newest ones.** Bilibili shows visitors who are not logged in only the top and newest comments of each video, plus the first replies under them, usually 5 to 60 comments per video. The `comments` field of a video shows how many exist in total. For large volumes of viewer reactions, use danmaku.
- **Danmaku is a sample on very popular videos.** Bilibili keeps a rolling pool of a few hundred to a few thousand danmaku per video, and the Actor returns that pool.
- **Search listings do not include coins and shares.** Turn on **Add full statistics** to add them.

### Tips

- **Search in Chinese.** A brand's Chinese name usually finds many more videos than its Latin name. Add both as separate keywords. Duplicates are not removed across keywords, and each result has a `searchQuery` field that says which keyword found it.
- **Run it on a schedule.** Scrape the same keywords or creators every day to track growth over time.

### FAQ

**Is it legal?** The Actor collects only data that Bilibili shows publicly to every visitor. Results can contain personal data such as usernames. Make sure you have a legitimate reason to process it, as required by the GDPR and similar laws.

**Does it download videos?** No. It collects metadata, comments and danmaku.

**Something is broken or missing?** Open a ticket in the Issues tab. Issues are usually answered within a day.

# Actor input Schema

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

Choose the kind of data you need. Each mode uses the matching input below.

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

Used in search mode. Chinese and English both work, for example "Nike", "耐克" or "AI tutorial". Chinese keywords usually find far more videos.

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

Used in video details, comments and danmaku modes. Accepts video URLs, b23.tv short links, BV ids and av ids.

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

Used in creator uploads and creator profiles modes. Accepts space.bilibili.com URLs or numeric user ids.

## `maxItems` (type: `integer`):

Maximum number of results to save in this run.

## `maxItemsPerQuery` (type: `integer`):

Optional. Limits results for each keyword, each creator or each video, so that one big source does not use up the whole run.

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

Used in search mode.

## `duration` (type: `string`):

Used in search mode.

## `includeDetails` (type: `boolean`):

Used in search and creator uploads modes. Opens every video to add coins, shares, likes and tags. Makes two extra requests per video, so runs take longer.

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

Used in comments mode. Also saves the replies under each comment. Every reply counts as one result.

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

Optional. The Actor works without a proxy. Turn one on only if runs start failing with blocked requests.

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "AI"
  ],
  "maxItems": 100,
  "sortOrder": "totalrank",
  "duration": "any",
  "includeDetails": false,
  "includeReplies": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Videos, creators, comments or danmaku saved by the run, one item per result.

# 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": [
        "AI"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pipiagent/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": ["AI"] }

# Run the Actor and wait for it to finish
run = client.actor("pipiagent/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": [
    "AI"
  ]
}' |
apify call pipiagent/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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