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

Search Bilibili videos by keyword and get views, likes, coins, favorites, shares, danmaku, tags and author followers. Also comments, danmaku (bullet comments), creator profiles and trending lists. No login. Clean Excel rows.

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

## Pricing

from $0.70 / 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.
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

### What does Bilibili Scraper do?

Bilibili (哔哩哔哩, B站) is China's biggest video site for young people. This scraper turns it into clean rows for Excel, Google Sheets, your app or your AI agent. No login, no cookie, no API key.

It has six modes:

- **Search videos** by keyword, in Chinese or English. Get views, likes, coins, favorites, shares, danmaku count, comment count, tags, category, length, publish date and the author's follower count. Add as many keywords as you like in one run.
- **Video details** from video links, BV ids, av ids or b23.tv short links.
- **Comments** of any video, with their reply threads.
- **Danmaku** (弹幕, the bullet comments that fly over the video), one row each, with the exact second on the video.
- **Creator profiles**: followers, following, number of videos, total likes, level, verification and bio.
- **Trending**: Popular now, the Top 100 ranking by category (gaming, tech, music, food and more), and Bilibili's hot searches.

### Why this one?

- **Many keywords in one run.** Each keyword is searched on its own and every row says which keyword found it.
- **More than 1,000 videos per keyword.** Bilibili stops at about 1,000 results per search. Ask for more (up to 5,000) and the scraper searches again in date windows to find them.
- **Accurate.** We checked the numbers against Bilibili's own video pages: views, likes, coins, favorites, shares, danmaku and comment counts all matched.
- **More danmaku.** Bilibili keeps two public danmaku pools that barely overlap. The scraper reads both and merges them, so you get far more bullet comments per video.
- **Reliable.** Every request retries on its own and switches connection if Bilibili slows it down. If one video fails, the rest of the run still finishes.
- **Fair billing.** You pay only for rows saved. Deleted or private videos, bad links and requests that stay blocked are skipped and **not charged**.

### How much does it cost?

You pay per row saved (a video, a comment, a danmaku, a creator or a hot search). Check the **Pricing** tab for the current price. The "Max" settings let you control how many rows a run can save.

### How to use it

1. Pick **What to scrape**.
2. Fill in the matching box: keywords, video links or creator ids. Trending needs nothing else.
3. Optional: sort, video length, date range, comments per video, danmaku per video.
4. Click **Start**. Download as Excel, CSV, JSON or HTML, or use the API.

### Input example

```json
{
  "mode": "search",
  "keywords": ["机械键盘", "iPhone 17"],
  "sort": "views",
  "maxResults": 100,
  "publishedAfter": "2026-09-01",
  "includeComments": true,
  "maxCommentsPerVideo": 20
}
```

### Output example

```json
{
  "type": "video",
  "searchKeyword": "iPhone 17",
  "rank": 1,
  "bvid": "BV12Kpxz9Eyb",
  "url": "https://www.bilibili.com/video/BV12Kpxz9Eyb",
  "title": "「小白」iPhone17全面测评：你想看的都在这了！",
  "author": "小白测评",
  "authorFollowers": 4729409,
  "category": "数码",
  "tags": "2025苹果秋季新品, 数码, iPhone17, A19芯片",
  "duration": "19:48",
  "publishedAt": "2025-09-17T12:00:00Z",
  "views": 2104350,
  "likes": 53238,
  "coins": 27040,
  "favorites": 11874,
  "shares": 8155,
  "danmakuCount": 12122,
  "commentCount": 5843
}
```

Every row has a `type` (video, comment, danmaku, creator or hotSearch). The output tabs **Videos**, **Comments**, **Danmaku**, **Creators** and **Hot searches** show the right columns for each.

A danmaku row looks like this:

```json
{ "type": "danmaku", "videoBvid": "BV1FD4y197Cg", "time": "0:05", "timeSecs": 5.829, "text": "妈 看看 咋个样",
  "sentAt": "2020-12-15T11:21:12Z", "mode": "bottom", "color": "#E70012", "senderHash": "2cd342e8" }
```

### Good to know

- **Comments:** Bilibili shows logged-out visitors only the top comments of a video (usually 3). This scraper never logs in, so you get those top comments plus their full reply threads, up to your limit. That is often dozens of comments per video, but not every comment.
- **Danmaku:** Bilibili keeps a limited pool of danmaku per video, not every one ever sent. Long, busy videos return thousands.
- **Dates** are in UTC. The date filter includes the whole "published before" day.
- **Full stats** (coins, shares, tags, author followers) need one extra request per video. They are on by default; turn them off for faster, lighter runs.
- **senderHash** is Bilibili's public, anonymous code for the danmaku sender. It lets you count unique senders, but it does not show who they are.

### Use cases

- **Brand and product research** in China: what young Chinese viewers say about a brand, product or launch.
- **Trend watching:** schedule the Trending mode daily to see what is popular, by category.
- **Creator and influencer research:** compare creators by followers, likes and engagement.
- **AI and NLP data:** comments and danmaku as real Chinese conversation data.
- **Market research** for games, anime, tech, cars, food and more.

### Is it legal?

It collects only public data that Bilibili shows to any logged-out visitor. It does not log in, solve captchas or collect private data. Check that your use follows Bilibili's terms and the law where you are.

# Actor input Schema

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

Pick one per run. No login or cookie needed in any mode.

## `keywords` (type: `array`):

Search mode. One keyword per line, in Chinese or English. Each keyword is searched separately.

## `sort` (type: `string`):

Same sort options as Bilibili's own search.

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

Bilibili's own duration filter.

## `publishedAfter` (type: `string`):

Optional. Only videos published on or after this date (YYYY-MM-DD, UTC).

## `publishedBefore` (type: `string`):

Optional. Only videos published on or before this date (YYYY-MM-DD, UTC, the whole day is included).

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

Bilibili shows about 1,000 videos per search. Above 1,000 the scraper searches again in date windows to find more, up to 5,000.

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

For Video details, Comments and Danmaku. Accepts bilibili.com/video/BV... links, BV ids, av ids and b23.tv short links. Add ?p=2 to a link for one part of a multi-part video.

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

Search and Trending modes: one extra request per video adds coins, shares, exact likes, tags and the author's follower count. Same price per row.

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

Search, Video details and Trending modes: adds comment rows (type: comment) for each video. Every comment is one billed row.

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

Bilibili shows logged-out visitors the top comments of a video. You get those plus their full reply threads, up to this number.

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

Danmaku mode. Each danmaku (bullet comment) is one row with its exact second on the video.

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

Creator profiles mode. The number in space.bilibili.com/NUMBER, or the full link.

## `trendingList` (type: `string`):

Trending mode.

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

For the Top 100 ranking.

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

How many requests run at the same time. 5 is fast and gentle.

## `proxy` (type: `object`):

Not needed: the scraper connects directly and switches to Apify proxies by itself if Bilibili slows it down. Set one only if you want every request to use it.

## Actor input object example

```json
{
  "mode": "search",
  "keywords": [
    "机械键盘",
    "iPhone 17"
  ],
  "sort": "relevance",
  "duration": "any",
  "maxResults": 20,
  "includeDetails": true,
  "includeComments": false,
  "maxCommentsPerVideo": 20,
  "maxDanmakuPerVideo": 1000,
  "trendingList": "popular",
  "category": "all",
  "maxConcurrency": 5
}
```

# Actor output Schema

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

No description

## `all` (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 = {
    "keywords": [
        "机械键盘",
        "iPhone 17"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("serenido/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 = { "keywords": [
        "机械键盘",
        "iPhone 17",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("serenido/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 '{
  "keywords": [
    "机械键盘",
    "iPhone 17"
  ]
}' |
apify call serenido/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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