# Bilibili Scraper: Videos, Search, Rankings & Danmaku (No Login) (`cn-data-lab/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩 / B站) videos by URL, keyword search or Top 100 ranking: views, likes, coins, favorites, tags, channel, plus full-timeline danmaku (bullet comments) with reaction peaks. No login, no cookies.

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

## Pricing

from $3.00 / 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, Search, Rankings & Danmaku (No Login)

Scrape **Bilibili** (哔哩哔哩 / B站), China's largest video platform for Gen Z, anime, gaming, tech and lifestyle content. You get structured video data and **danmaku (弹幕, bullet comments)** with **no login, no cookies and no browser**.

- 🔎 **Keyword search**: up to 1,000 videos per keyword, in Chinese or English, sorted by relevance, views, newest, danmaku or favorites
- 🏆 **Trending**: the official Bilibili **Top 100 ranking** (排行榜), for all categories or one category (games, tech, music, anime and more)
- 🎬 **Video URLs / BV IDs / av IDs / b23.tv short links**
- 📊 **Full engagement stats** for every video: views, likes, **coins**, favorites, shares, danmaku count, comment count, tags, duration, publish date, channel
- 💬 **Danmaku across the whole timeline**. Many scrapers use the legacy XML feed, which is capped at the newest ~1,000–3,000 messages. This Actor reads danmaku in 6-minute segments, so a single video can return tens of thousands of messages.
- 📈 **Reaction timeline and peak moments**: each video comes with a danmaku density histogram and its top 5 "most reacted" moments. Use it to find highlights, viral moments and ad placement points.
- 🔒 **Privacy-friendly by default**: danmaku are anonymous by design, and commenter identities are **not** stored unless you explicitly enable it
- 💸 **Low price, pay only for results**: $3 per 1,000 videos and $0.20 per 1,000 danmaku

### Who uses Bilibili data?

| Use case | What you get |
|---|---|
| **Brand & market research in China** | What Chinese Gen Z says about your product, game, car or phone, in real time |
| **Game publishers & studios** | Reactions to trailers, launches and patches (e.g. *Black Myth: Wukong*, *Genshin Impact*), moment by moment |
| **Influencer / KOL discovery** | Top channels for a keyword with views, likes, coins and favorites |
| **AI / LLM datasets** | Large amounts of authentic, timestamped Chinese conversational text (danmaku) |
| **Academic research** | Media studies, sentiment analysis and online culture in China |
| **Trend monitoring** | Run the Top 100 ranking on a schedule and track what goes viral |

### How to use

1. Click **Try for free**.
2. Add **video URLs**, **search keywords**, and/or turn on **Top 100 ranking**.
3. Optionally turn on **Scrape danmaku**.
4. Click **Start** and download the results as JSON, CSV, Excel or HTML, or get them through the API.

#### Input example

```json
{
  "searchKeywords": ["iPhone 17 测评", "Black Myth Wukong"],
  "maxVideosPerKeyword": 50,
  "searchOrder": "click",
  "includeRanking": true,
  "rankingCategoryId": 188,
  "maxRankingVideos": 20,
  "videoUrls": ["https://www.bilibili.com/video/BV17x411w7KC", "https://b23.tv/BV1xx411c7mD"],
  "scrapeDanmaku": true,
  "maxDanmakuPerVideo": 2000
}
```

| Field | Description |
|---|---|
| `videoUrls` | Bilibili video URLs, `BV…` or `av…` IDs, mobile links or b23.tv short links |
| `searchKeywords` | Keywords to search (Chinese or English) |
| `maxVideosPerKeyword` | Max results per keyword (1–1,000, default 20) |
| `searchOrder` | `totalrank` (relevance), `click` (most viewed), `pubdate` (newest), `dm` (most danmaku), `stow` (most favorited) |
| `includeRanking` / `rankingCategoryId` / `maxRankingVideos` | Official Top 100 ranking. `0` = all categories. Examples: `4` games, `188` tech, `36` knowledge, `3` music, `1` anime, `211` food, `160` lifestyle |
| `scrapeDanmaku` / `maxDanmakuPerVideo` | Download danmaku (bullet comments) and cap how many are saved per video |
| `danmakuTimelineBucketSec` | Bucket size for the reaction timeline (default 30 s) |
| `includeTags` | Add the uploader's tags (default on) |
| `includeTopComments` | Add a preview of the top hot comments (up to 3; free) |
| `includeCommentAuthor` | Store commenter nicknames (off by default) |
| `maxConcurrency` | Parallel requests (default 3) |
| `proxyConfiguration` | Optional; normally not needed |

### Output

Every dataset item has a `type`: `video`, `danmaku`, or `error`. The dataset has two ready-made views, **Videos** and **Danmaku**.

#### Video item (real example)

```json
{
  "type": "video",
  "bvid": "BV1A4421f7nX",
  "url": "https://www.bilibili.com/video/BV1A4421f7nX",
  "title": "【完结】《黑神话：悟空》全程无伤全收集全成就全支线全结局全BOSS无伤 | 完美剧情流程攻略-4K…",
  "coverUrl": "https://i0.hdslb.com/bfs/archive/7560426b7ad02534806b8fb695f437d1cc4d6c0b.png",
  "durationSec": 100357,
  "publishedAt": "2024-08-20T17:40:22+00:00",
  "partsCount": 59,
  "channelId": 288742222,
  "channelName": "劍訣浮雲",
  "channelUrl": "https://space.bilibili.com/288742222",
  "views": 1394920,
  "danmakuCount": 20522,
  "comments": 2086,
  "likes": 29524,
  "coins": 23907,
  "favorites": 24402,
  "shares": 3242,
  "tags": ["西游记", "孙悟空", "黑神话悟空", "黑神话", "游戏科学", "国产3A"],
  "danmakuScraped": 300,
  "danmakuPeaks": [{"startSec": 210, "count": 21}, {"startSec": 630, "count": 16}],
  "danmakuTimeline": [{"startSec": 0, "count": 15}, {"startSec": 30, "count": 14}],
  "source": "search",
  "searchKeyword": "黑神话 悟空",
  "searchRank": 2,
  "scrapedAt": "2026-10-18T07:56:57+00:00"
}
```

#### Danmaku item (real example)

```json
{
  "type": "danmaku",
  "bvid": "BV1xx411c7mD",
  "cid": 62131,
  "danmakuId": "12338673447075844",
  "text": "唯一活着的老片",
  "videoTimeSec": 0.0,
  "postedAt": "2019-02-20T15:25:26+00:00",
  "mode": 5,
  "fontSize": 25,
  "color": "#ffd302"
}
```

`mode`: 1–3 = scrolling, 4 = bottom, 5 = top, 7 = advanced.

### Pricing (pay per event)

| Event | Price |
|---|---|
| Video (one video item with full stats) | **$0.003** ($3 per 1,000) |
| Danmaku (one bullet comment) | **$0.0002** ($0.20 per 1,000) |

Failed or deleted videos come back as `error` items and are **not charged**. The Actor respects your **maximum cost per run** and stops cleanly when it reaches it.

Example costs: 1,000 videos from keyword search ≈ **$3**. 50 videos with 2,000 danmaku each ≈ $0.15 + $20.

### FAQ

**Do I need a Bilibili account or cookies?** No. The Actor only uses the public data that Bilibili shows to any logged-out visitor.

**How fast is it?** In our tests it scraped about 380 videos with full stats in about 2.5 minutes, and 22 videos plus 13,000 danmaku in under 40 seconds, with the default concurrency.

**Why only up to 3 comments?** Bilibili shows logged-out visitors just a short preview of the comment section. This Actor never logs in, so it returns that preview for free. For audience reactions at scale, use **danmaku**: they are public, plentiful and anonymous.

**Multi-part videos?** Danmaku are collected for the first part (P1) of a multi-part video. The video stats cover the whole video.

**Is it legal?** The Actor collects only publicly available data, without logging in or bypassing access controls, and it doesn't store personal data by default. You are responsible for using the data in line with Bilibili's terms and the laws that apply to you (e.g. GDPR, PIPL). If you are unsure, ask a lawyer.

**Can I schedule it or use it through the API, Make, Zapier or an AI agent?** Yes. It works with Apify schedules, webhooks and the API, with integrations such as Make, Zapier, n8n and Google Sheets, and with MCP clients for AI agents.

### Keywords

Bilibili scraper, Bilibili API, B站爬虫, 哔哩哔哩数据, 弹幕爬虫, Bilibili danmaku downloader, bullet comments, Bilibili video stats, Bilibili search scraper, Bilibili ranking, China social media data, Chinese video data, Bilibili comments, Bilibili analytics.

### Feedback

Found a bug or want a feature (creator uploads, all-parts danmaku, scheduled ranking diffs)? Open an issue on the Actor's **Issues** tab and we'll respond quickly.

# Actor input Schema

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

Bilibili video URLs (bilibili.com/video/BV..., m.bilibili.com, b23.tv short links) or plain BV / av IDs.

## `searchKeywords` (type: `array`):

Search Bilibili videos by keyword (Chinese or English), e.g. 原神, Black Myth Wukong, iPhone 17 测评.

## `maxVideosPerKeyword` (type: `integer`):

How many search results to scrape per keyword (Bilibili returns up to 1,000 results per query).

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

How search results are sorted.

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

Also scrape the official Bilibili Top 100 ranking.

## `rankingCategoryId` (type: `integer`):

0 = all categories. Examples: 1 anime/MAD, 3 music, 4 games, 36 knowledge, 188 tech, 160 lifestyle, 211 food, 217 animals, 119 kichiku, 129 dance, 181 film & TV.

## `maxRankingVideos` (type: `integer`):

How many videos to take from the ranking (max 100).

## `scrapeDanmaku` (type: `boolean`):

Download danmaku across the whole video timeline. Each danmaku is saved as its own dataset item, and each video gets a reaction timeline + peak moments.

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

Upper limit of danmaku items saved per video (charged per item).

## `danmakuTimelineBucketSec` (type: `integer`):

Bucket size used for the danmaku reaction timeline and peak detection.

## `includeTags` (type: `boolean`):

Add the uploader's tags to each video.

## `includeTopComments` (type: `boolean`):

Add the top hot comments (Bilibili shows guests a short preview, up to 3) to each video item. No extra charge.

## `includeCommentAuthor` (type: `boolean`):

By default no commenter identities are stored. Enable only if you have a lawful basis to process them.

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

Parallel video requests. Keep it low (2-4) to stay polite and avoid rate limiting.

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

Optional. Usually not needed. Use it only if you see rate-limit errors.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.bilibili.com/video/BV1xx411c7mD"
  ],
  "searchKeywords": [
    "黑神话 悟空"
  ],
  "maxVideosPerKeyword": 20,
  "searchOrder": "totalrank",
  "includeRanking": false,
  "rankingCategoryId": 0,
  "maxRankingVideos": 100,
  "scrapeDanmaku": false,
  "maxDanmakuPerVideo": 1000,
  "danmakuTimelineBucketSec": 30,
  "includeTags": true,
  "includeTopComments": false,
  "includeCommentAuthor": false,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `danmaku` (type: `string`):

No description

## `results` (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 = {
    "videoUrls": [
        "https://www.bilibili.com/video/BV1xx411c7mD"
    ],
    "searchKeywords": [
        "黑神话 悟空"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("cn-data-lab/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 = {
    "videoUrls": ["https://www.bilibili.com/video/BV1xx411c7mD"],
    "searchKeywords": ["黑神话 悟空"],
}

# Run the Actor and wait for it to finish
run = client.actor("cn-data-lab/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 '{
  "videoUrls": [
    "https://www.bilibili.com/video/BV1xx411c7mD"
  ],
  "searchKeywords": [
    "黑神话 悟空"
  ]
}' |
apify call cn-data-lab/bilibili-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cn-data-lab/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/fxqkW1h8lTrX7Z10l/builds/7Bsyoixd40YDQG70M/openapi.json
