# Bilibili Scraper — Video, Comments, Danmaku & UP主 (B站) (`haketa/bilibili-scraper`) Actor

Scrape Bilibili (B站/哔哩哔哩) without an API key or login. Export videos, engagement stats (views, likes, coins, favorites, danmaku 弹幕), comments and creator/UP主 profiles by keyword, URL or trending feed. A fast Bilibili API alternative for market research, KOL lead-gen and AI datasets. JSON/CSV/Excel.

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

## Pricing

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

## Bilibili Scraper 🎬 — Videos, Comments, Danmaku & Creators (B站 / 哔哩哔哩)

> **Scrape Bilibili (B站 / 哔哩哔哩)** video metadata, engagement metrics, **comments**, **danmaku (弹幕)** bullet comments, and **creator / UP主** profiles at scale — by keyword, video URL, creator ID, or trending feed. **No API key. No login. No cookies.**

[![Works Without Login](https://img.shields.io/badge/Login-Not%20Required-brightgreen)](#)
[![No API Key](https://img.shields.io/badge/API%20Key-Not%20Required-brightgreen)](#)
[![Export Formats](https://img.shields.io/badge/Export-JSON%20%7C%20CSV%20%7C%20Excel%20%7C%20API-blue)](#)
[![Danmaku Included](https://img.shields.io/badge/%E5%BC%B9%E5%B9%95-Danmaku%20Included-ff69b4)](#)
[![Scale](https://img.shields.io/badge/Scale-1%2C000%2B%20Videos%20%2F%20Run-orange)](#)
[![Languages](https://img.shields.io/badge/Search-EN%20%2B%20%E4%B8%AD%E6%96%87-purple)](#)

This **Bilibili scraper** turns public data on [Bilibili](https://www.bilibili.com) (**哔哩哔哩**, widely known as **B站** or *bili bili*) — China's premier video community, home of **danmaku (弹幕)** bullet comments and a massive **UP主** creator ecosystem — into clean, structured **JSON, CSV, and Excel** datasets. Use it as a fast, drop-in **Bilibili API alternative**: enter keywords in English or Chinese, paste video URLs or creator IDs, or enable the trending feed, press **Start**, and stream structured records in seconds.

> **🎯 Built for KOL / influencer marketing agencies, China market researchers, social-listening & brand-intelligence teams, AI / NLP dataset engineers, MCNs, and media analysts.**

***

### ⚡ At a Glance

| Feature | Details |
| --- | --- |
| **Target Platform** | [Bilibili.com](https://www.bilibili.com) (哔哩哔哩 / B站) |
| **Extraction Modes** | Keyword Search (`EN` + `中文`), Trending / Popular Feed, Direct Video URLs (`BV` / `av`), Creator Profiles (`UP主`) |
| **Video Metrics Captured** | Views (`播放`), Danmaku Count (`弹幕`), Likes (`点赞`), Favorites (`收藏`), Comments (`评论`), Coins (`投币`), Shares (`分享`) |
| **Per-Video Enrichment** | Top Comments sorted by likes (`topComments[]`) + On-screen Danmaku bullet comments with timestamps (`danmaku[]`) |
| **Creator / KOL Lead Gen** | Followers, Following, Video Count, Total Likes, Level, Official Verification, Bio, and auto-extracted **Business Email** |
| **Pagination & Scale** | Auto-scaling pagination (`searchPages: 0` = auto) — **1,000+ unique videos per run** (~42 videos/page, up to 50 pages/keyword) |
| **Deduplication** | Automatic cross-keyword & cross-mode deduplication by `bvid` |
| **Engine & Cost** | High-speed pure HTTP with parallel enrichment (`maxConcurrency`) and default Apify Proxy |

***

### 📑 Table of Contents

- [Why Scrape Bilibili?](#-why-scrape-bilibili)
- [What This Bilibili Scraper Does](#-what-this-bilibili-scraper-does)
- [Use Cases](#-use-cases)
- [Input Configuration](#-input-configuration)
- [Output Schema & Field Reference](#-output-schema--field-reference)
- [Pagination & 1,000+ Scale](#-pagination--1000-scale)
- [How to Use](#️-how-to-use)
- [API Usage Examples](#-api-usage-examples)
- [Tips for Best Results](#-tips-for-best-results)
- [FAQ](#-faq)
- [Related Scrapers](#-related-scrapers)
- [Changelog](#-changelog)

***

### 🔎 Why Scrape Bilibili?

**Bilibili data** is one of the richest consumer, gaming, tech, anime, and youth-culture signals on the Chinese internet. With over 300 million monthly active users, B站 is where Chinese audiences review hardware, discuss AI and programming, launch gaming trends, evaluate consumer brands, and react in real time via **danmaku (弹幕)** — synchronized bullet comments that fly across the video timeline.

Collecting Bilibili data manually or maintaining custom scripts is challenging:

- **No open bulk export API:** Bilibili does not provide a public developer API for bulk video search, danmaku extraction, or UP主 lead generation.
- **Fragmented engagement metrics:** Views, danmaku counts, likes, favorites, comments, coins, and creator contact details live across separate feeds and formats (JSON + compressed XML for danmaku).
- **HTML entities & encoding quirks:** Raw search responses embed HTML markup and encoded entities (`&quot;`, `&amp;`, `&#x27;`) inside titles and descriptions, while danmaku streams use deflated XML attribute tuples.

This **Bilibili data extractor** handles every step automatically: it paginates across keywords and trending feeds, decodes all text cleanly, resolves video stream IDs (`cid`) when danmaku are requested, extracts **business emails** from UP主 bios, and outputs ready-to-analyze records.

***

### ✨ What This Bilibili Scraper Does

- ✅ **Four flexible discovery modes in one actor** — combine 🔎 **Keyword Search** (English or 中文), 🔥 **Trending / Popular Feed**, 🎬 **Direct Video URLs / BV IDs**, and 👤 **Creator / UP主 Profiles** in a single run.
- ✅ **Unlocked 1,000+ video pagination** — set `searchPages: 0` (the default) and the scraper automatically calculates and walks as many result pages as needed (~42 videos per page, up to 50 pages per keyword) to hit your `maxVideos` target (`1,000+` videos supported).
- ✅ **Complete video engagement metrics** — captures `views` (播放), `danmakuCount` (弹幕), `likes` (点赞), `favorites` (收藏), and `comments` (评论) on every search and trending video, plus `coins` (投币) and `shares` (分享) on the trending feed.
- ✅ **Rich video metadata** — `bvid`, `aid`, `cid`, canonical `url`, decoded `title` and `description`, HTTPS `cover` image, `category` (分区), `durationSeconds`, ISO-8601 `publishedAt`, `tags`, and creator attribution (`author`, `authorMid`, `authorUrl`, `authorAvatar`).
- ✅ **UP主 / Creator KOL lead generation** — extracts `followers`, `following`, `videoCount`, `totalLikes`, `level`, `official` verification title, `bio`, and automatically parses any **business email (`businessEmail`)** listed in the creator's bio.
- ✅ **Optional Top Comments (`includeComments`)** — attaches top-liked audience comments with author name, `authorMid`, `likes`, `replyCount`, and ISO timestamp.
- ✅ **Optional Danmaku Bullet Comments (`includeDanmaku`)** — downloads and parses Bilibili's signature on-screen bullet comments with `text`, exact video timestamp (`videoTimeSec`), and `sentAt` date.
- ✅ **Zero-config fallback** — running with empty input `{}` automatically returns a fresh sample of trending and popular Bilibili videos, scaling across fallback topics if you request a large `maxVideos`.

***

### 🎯 Use Cases

| Persona / Team | How They Use This Bilibili Scraper |
| --- | --- |
| **KOL & Influencer Marketing Agencies** | Discover rising **UP主** in gaming, tech, beauty, or food; rank by `followers` and `totalLikes`, and reach out directly via `businessEmail`. |
| **Global Brands & Social Listening** | Track brand mentions, product launches, and competitor reviews on B站; analyze **danmaku** at exact video timestamps (`videoTimeSec`) to see which product features spark excitement. |
| **AI, NLP & LLM Data Engineers** | Build high-volume, authentic Chinese conversational and time-aligned video reaction corpora from `topComments[]` and `danmaku[]`. |
| **Gaming & Entertainment Publishers** | Monitor trailer reactions, gameplay guides, and community sentiment for titles like *Genshin Impact (原神)*, *Black Myth: Wukong (黑神话：悟空)*, and indie releases. |
| **Content Strategists & MCNs** | Benchmark video performance across categories (`分区`), optimal video durations (`durationSeconds`), tag combinations, and upload times (`publishedAt`). |
| **Market & Academic Researchers** | Study digital youth culture, danmaku linguistics, and Chinese creator-economy dynamics with clean CSV/JSON exports. |

***

### 📥 Input Configuration

All fields are optional. Fill in any combination of modes — or press **Start** with the default prefill for a fast 40-video run.

| Field | Key | Type | Default | Description |
| --- | --- | --- | --- | --- |
| **🔎 Search keywords** | `searchKeywords` | `array<string>` | `["python tutorial"]` | Keywords in English or Chinese (e.g., `"python"`, `"美食"`, `"原神"`, `"机器学习"`). |
| **🎬 Video URLs or IDs** | `videoUrls` | `array<string>` | `[]` | Direct Bilibili video URLs (`https://www.bilibili.com/video/BV1...`) or bare `BV` IDs. |
| **👤 Creators (UP主)** | `userIds` | `array<string>` | `[]` | Creator space URLs (`https://space.bilibili.com/431073645`) or numeric `mid` IDs. |
| **🔥 Include trending videos** | `scrapePopular` | `boolean` | `false` | Pull Bilibili's current popular / trending video feed (includes `coins` and `shares`). |
| **Trending count** | `popularCount` | `integer` | `30` | Number of trending videos to fetch when `scrapePopular` is enabled (`1`–`5000`). |
| **💬 Include comments** | `includeComments` | `boolean` | `false` | Attach top comments (sorted by likes) to each scraped video. |
| **Max comments per video** | `maxCommentsPerVideo` | `integer` | `20` | Maximum comments to collect per video (`1`–`1000`). |
| **🌊 Include danmaku** | `includeDanmaku` | `boolean` | `false` | Attach on-screen bullet comments (`danmaku[]`) with video timestamp and text. |
| **Max danmaku per video** | `maxDanmakuPerVideo` | `integer` | `200` | Maximum danmaku bullet comments per video (`1`–`6000`). |
| **Search pages per keyword** | `searchPages` | `integer` | `0` (Auto) | Pages to fetch per keyword (~42 videos/page). `0` = automatic scaling governed by `maxVideos`. |
| **Sort search results by** | `searchOrder` | `string` | `"totalrank"` | `totalrank` (Best match), `click` (Most viewed), `pubdate` (Newest), `dm` (Most danmaku), `stow` (Most favorited). |
| **Max videos** | `maxVideos` | `integer` | `100` (prefill `40`) | Total video cap across all keywords and feeds. Set `0` for unlimited (`1,000+` supported). |
| **Max concurrent requests** | `maxConcurrency` | `integer` | `8` | Parallel workers for comment/danmaku enrichment (`1`–`20`). |
| **Proxy configuration** | `proxyConfiguration` | `object` | `{ "useApifyProxy": true }` | Apify Proxy configuration. Default proxy works out of the box across all modes. |

#### Example 1 — Bulk Keyword Search (1,000+ Videos Across Topics)

```json
{
  "searchKeywords": ["人工智能", "机器学习", "深度学习", "大模型"],
  "searchPages": 0,
  "searchOrder": "totalrank",
  "maxVideos": 1200,
  "includeComments": false,
  "includeDanmaku": false
}
```

#### Example 2 — Video Search + Top Comments & Danmaku Bullet Comments

```json
{
  "searchKeywords": ["原神", "黑神话悟空"],
  "searchOrder": "click",
  "includeComments": true,
  "maxCommentsPerVideo": 30,
  "includeDanmaku": true,
  "maxDanmakuPerVideo": 300,
  "maxVideos": 100
}
```

#### Example 3 — UP主 / Creator KOL Lead Generation List

```json
{
  "userIds": [
    "https://space.bilibili.com/431073645",
    "https://space.bilibili.com/2267573",
    "946974"
  ]
}
```

#### Example 4 — Bilibili Trending Feed Sweep (with Coins & Shares)

```json
{
  "searchKeywords": [],
  "scrapePopular": true,
  "popularCount": 200,
  "maxVideos": 200
}
```

***

### 📤 Output Schema & Field Reference

Each dataset item is a clean, flat JSON object representing either a **video** (`recordType: "video"`) or a **creator profile** (`recordType: "creator"`).

#### Sample Video Record (`recordType: "video"`)

```json
{
  "recordType": "video",
  "bvid": "BV1rpWjevEip",
  "aid": 113006243481679,
  "cid": 258910421,
  "url": "https://www.bilibili.com/video/BV1rpWjevEip",
  "title": "【全748集】目前B站最全最细的Python零基础全套教程，2026最新版",
  "description": "本套教程从零开始讲解，手把手教学，包含基础语法、进阶语法、爬虫、自动化办公、数据分析…",
  "cover": "https://i2.hdslb.com/bfs/archive/a979056b1a32012cdd00d48fbc3732d253e30620.jpg",
  "category": "计算机技术",
  "durationSeconds": 143894,
  "publishedAt": "2024-08-22T14:59:18.000Z",
  "views": 21406006,
  "danmakuCount": 135253,
  "likes": 590100,
  "coins": null,
  "favorites": 907462,
  "shares": null,
  "comments": 367891,
  "author": "Python官方课程",
  "authorMid": 3546597933714079,
  "authorUrl": "https://space.bilibili.com/3546597933714079",
  "authorAvatar": "https://i1.hdslb.com/bfs/face/6822e4fdc8f82c69e10accd1ab11a109702bccbf.jpg",
  "tags": "程序员,Python教程,Python入门零基础,计算机,编程语言,数据分析",
  "sourceType": "search",
  "sourceQuery": "python tutorial",
  "scrapedAt": "2026-11-10T05:00:00.000Z"
}
```

#### Sample Creator / UP主 Record (`recordType: "creator"`)

```json
{
  "recordType": "creator",
  "mid": "431073645",
  "name": "你的影月月",
  "spaceUrl": "https://space.bilibili.com/431073645",
  "followers": 10138744,
  "following": 312,
  "videoCount": 2190,
  "totalLikes": 88450231,
  "bio": "攻略在合集观看！商务合作邮箱 jyybiz@qq.com",
  "businessEmail": "jyybiz@qq.com",
  "level": 6,
  "official": "2025百大UP主、知名游戏UP主",
  "officialType": "personal",
  "avatar": "https://i2.hdslb.com/bfs/face/example.jpg",
  "scrapedAt": "2026-11-10T05:00:00.000Z"
}
```

#### Emoji-Grouped Field Reference & Coverage

##### 🎬 Video Identity & Content

| Field | Type | Coverage | Description |
| --- | --- | --- | --- |
| `recordType` | `string` | 🟢 High (100%) | Always `"video"` for video records. |
| `bvid` | `string` | 🟢 High (100%) | Unique Bilibili alphanumeric BV identifier (e.g., `BV1rpWjevEip`). |
| `aid` | `integer\|null` | 🟢 High (99%+) | Numeric archive ID (`av` number) used for comments. |
| `cid` | `integer\|null` | 🟡 Conditional | Stream player ID — populated on trending videos and whenever `includeDanmaku: true`. |
| `url` | `string` | 🟢 High (100%) | Canonical video URL (`https://www.bilibili.com/video/BV...`). |
| `title` | `string` | 🟢 High (100%) | Video title with HTML tags stripped and HTML entities decoded. |
| `description` | `string\|null` | 🟢 High (~77–95%) | Uploader's video description (present when provided by creator). |
| `cover` | `string` | 🟢 High (100%) | Full HTTPS URL to the video cover thumbnail. |
| `category` | `string\|null` | 🟢 High (100%) | Bilibili category / partition name (`分区`, e.g., `计算机技术`, `单机游戏`, `美食`). |
| `durationSeconds` | `integer` | 🟢 High (100%) | Total video duration converted to seconds. |
| `publishedAt` | `string\|null` | 🟢 High (100%) | Upload timestamp in ISO-8601 UTC format. |
| `tags` | `string\|null` | 🟢 High (98%+ search) | Comma-separated video tags on search results. |
| `sourceType` | `string` | 🟢 High (100%) | Discovery source: `"search"`, `"popular"`, or `"video"`. |
| `sourceQuery` | `string` | 🟢 High (100%) | Originating search keyword, `"popular"`, or `bvid`. |

##### 📊 Engagement Metrics & Creator Attribution

| Field | Type | Coverage | Description |
| --- | --- | --- | --- |
| `views` | `integer\|null` | 🟢 High (100%) | Total video play count (`播放`). |
| `danmakuCount` | `integer\|null` | 🟢 High (100%) | Total bullet comments (`弹幕`) on the video. |
| `likes` | `integer\|null` | 🟢 High (100%) | Total likes (`点赞`). |
| `favorites` | `integer\|null` | 🟢 High (100%) | Total favorites / bookmarks (`收藏`). |
| `comments` | `integer\|null` | 🟢 High (100%) | Total comment replies (`评论`). |
| `coins` | `integer\|null` | 🟡 Conditional | Coins given (`投币`) — **populated 100% on `scrapePopular` trending feed**; `null` on keyword search. |
| `shares` | `integer\|null` | 🟡 Conditional | Total shares (`分享`) — **populated 100% on `scrapePopular` trending feed**; `null` on keyword search. |
| `author` | `string\|null` | 🟢 High (100%) | Creator / UP主 display name. |
| `authorMid` | `integer\|null` | 🟢 High (100%) | Creator numeric member ID (`mid`). |
| `authorUrl` | `string\|null` | 🟢 High (100%) | Link to the creator's Bilibili Space (`https://space.bilibili.com/{mid}`). |
| `authorAvatar` | `string\|null` | 🟢 High (100%) | Full HTTPS URL to the creator's avatar image. |

##### 💬 Enrichment Arrays (`topComments[]` & `danmaku[]`)

| Field | Parent Array | Type | Description |
| --- | --- | --- | --- |
| `text` | `topComments[]` / `danmaku[]` | `string` | Decoded comment or bullet-comment text. |
| `author` / `authorMid` | `topComments[]` | `string` | Commenter username and numeric member ID. |
| `likes` / `replyCount` | `topComments[]` | `integer` | Likes and nested replies on the comment. |
| `time` | `topComments[]` | `string` | ISO-8601 timestamp when the comment was posted. |
| `videoTimeSec` | `danmaku[]` | `number` | Exact playback position (in seconds) where the bullet comment appears on screen. |
| `sentAt` | `danmaku[]` | `string` | ISO-8601 timestamp when the viewer sent the danmaku. |

##### 👤 Creator / UP主 Profile Fields (`recordType: "creator"`)

| Field | Type | Coverage | Description |
| --- | --- | --- | --- |
| `mid` / `name` / `spaceUrl` | `string` | 🟢 High (100%) | Creator ID, display name, and profile URL. |
| `followers` / `following` | `integer` | 🟢 High (100%) | Total fans (`粉丝`) and accounts followed. |
| `videoCount` / `totalLikes` | `integer` | 🟢 High (100%) | Total published videos and lifetime likes. |
| `bio` | `string\|null` | 🟢 High (90%+) | Creator's Space signature (`签名`). |
| `businessEmail` | `string\|null` | 🟡 Conditional | Business email parsed from `bio` when listed by the UP主 (ideal for KOL outreach). |
| `level` / `official` / `officialType` | `mixed` | 🟢 High | Account level (`0`–`6`) and official Bilibili verification badge (`百大UP主`, etc.). |

***

### 🔁 Pagination & 1,000+ Scale

This **Bilibili scraper** is built to scale smoothly from a 40-video quick check to **1,000–10,000+ unique videos** in a single run:

- **Auto-Scaling Keyword Pagination (`searchPages: 0`):** Each keyword search page returns **~42 videos** and supports up to **50 pages (~2,100 videos per keyword)**. When `searchPages` is `0` (default), the scraper automatically continues paginating until `maxVideos` is reached or all pages for that keyword are exhausted.
- **On-the-Fly Deduplication:** Duplicate videos across overlapping keywords or between search and trending feeds are filtered out immediately by `bvid` during discovery, ensuring `maxVideos: 1000` delivers **1,000 unique videos**.
- **Deep Trending Feed Pagination:** The trending feed (`scrapePopular: true`) paginates at 20 videos per page across up to 100 pages.
- **Parallel Comment & Danmaku Worker Pool:** When `includeComments` or `includeDanmaku` is enabled, a bounded worker pool (`maxConcurrency`, default `8`) enriches videos concurrently so runs finish in a fraction of sequential time.

***

### ⚙️ How to Use

1. Open **Bilibili Scraper** in the **Apify Console**.
2. Enter one or more **🔎 Search keywords** (English or Chinese), **🎬 Video URLs**, **👤 Creator IDs**, or enable **🔥 Include trending videos**.
3. *(Optional)* Check **💬 Include comments** and/or **🌊 Include danmaku** to attach audience conversations and bullet comments.
4. Set **Max videos** (`maxVideos` — e.g., `40` for a quick test, `1000`+ for bulk datasets, or `0` for unlimited) and click **Start**.
5. Download your data from the **Storage → Dataset** tab as **JSON, CSV, Excel, HTML, or RSS**, or fetch it via the **Apify API**.

***

### 💻 API Usage Examples

#### Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("haketa/bilibili-scraper").call(run_input={
    "searchKeywords": ["人工智能", "机器学习"],
    "searchPages": 0,
    "searchOrder": "totalrank",
    "includeComments": True,
    "maxCommentsPerVideo": 20,
    "maxVideos": 500,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["bvid"], item["title"], item["views"], item["danmakuCount"])
```

#### Node.js (`apify-client`)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });

const run = await client.actor('haketa/bilibili-scraper').call({
    searchKeywords: ['原神', '单机游戏'],
    includeDanmaku: true,
    maxDanmakuPerVideo: 200,
    maxVideos: 200,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Collected ${items.length} Bilibili records`);
```

***

### 💡 Tips for Best Results

- **Leave `searchPages` at `0` (Auto):** The scraper will automatically paginate as deep as needed for each keyword to reach your `maxVideos` target.
- **Search in Chinese for maximum volume:** Queries like `美食`, `编程`, `数码评测`, `人工智能`, and `原神` return far larger native catalogs than English translations.
- **Combine multiple keywords for 2,000+ video datasets:** Each keyword provides up to ~2,100 unique results; passing 3–5 related keywords easily scales to 5,000–10,000 unique videos.
- **Use `scrapePopular: true` when you need `coins` and `shares`:** Bilibili's trending endpoint includes the full stat block (`coins` + `shares`), whereas keyword search provides `views`, `danmakuCount`, `likes`, `favorites`, and `comments`.
- **Two-step KOL workflow:** Run a keyword search first, collect unique `authorMid` values from top-performing videos, then pass those IDs into `userIds` to extract full UP主 profiles and `businessEmail` contacts.

***

### ❓ FAQ

#### Do I need a Bilibili account, cookies, or API key?

No. The scraper works out of the box without any login, cookies, or developer credentials.

#### How many videos can I scrape in one run?

You can collect **1,000 to 10,000+ unique videos** in a single run. With `searchPages: 0` (auto), each keyword paginates up to 50 pages (~2,100 videos per keyword), and multiple keywords combine into one deduplicated dataset.

#### Why are `coins` and `shares` null on keyword search results?

Bilibili's search feed returns `views`, `danmakuCount`, `likes`, `favorites`, and `comments` on every video, but omits `coins` and `shares`. Enable **Include trending videos (`scrapePopular: true`)** when you specifically need `coins` and `shares` populated at 100%.

#### What is `danmaku` (弹幕)?

Danmaku are time-synced viewer comments that scroll directly across the video player at a specific second (`videoTimeSec`). Enabling `includeDanmaku: true` extracts the bullet-comment text, exact video timestamp in seconds, and post time.

#### How do I extract UP主 business emails for influencer outreach?

Paste creator Space URLs (`https://space.bilibili.com/431073645`) or numeric `mid` IDs into **Creators (`userIds`)**. The scraper fetches each creator's profile and automatically parses any email address in their bio into `businessEmail`.

***

### 🔗 Related Scrapers

Expand your Asian & global social media and video intelligence pipelines with our companion actors:

- [Xiaohongshu (RedNote) Scraper](https://apify.com/haketa/xiaohongshu-rednote-scraper) — Scrape notes, engagement metrics, and creators from China's RED / 小红书.
- [WeChat Official Account Scraper](https://apify.com/haketa/wechat-official-account-scraper) — Extract articles and publishing metrics from WeChat 公众号.
- [YouTube Channel Contact Scraper](https://apify.com/haketa/youtube-contact-scraper) — Pull creator business emails and social links from YouTube channels.
- [YouTube Comments Scraper](https://apify.com/haketa/youtube-comments-scraper) — High-speed YouTube comment thread and reply extractor.
- [Patreon Creator Scraper](https://apify.com/haketa/patreon-scraper) — Extract creator memberships, tiers, and earnings data.

***

### 📋 Changelog

#### v1.2.0 (2026-11)

- **Unlocked 1,000+ Auto-Scaling Pagination:** Changed `searchPages` default to `0` (auto-scaling governed by `maxVideos`) with up to 50 pages (~2,100 videos) per keyword, live discovery deduplication by `bvid`, and multi-keyword fallback scaling for empty runs.
- **Expanded Trending Feed Ceiling:** Increased `popularCount` limit up to `5,000` and raised popular feed pagination depth.
- **Fast Prefill Configuration:** Set `maxVideos` prefill to `40` so quick test runs finish in ~10–15 seconds.
- **Documentation Upgrade:** Added `⚡ At a Glance` summary table, emoji-grouped field tables with coverage indicators, and comprehensive API examples.

#### v1.1.0 (2026-11)

- **HTML Entity Decoding:** Added automatic decoding for HTML entities (`&quot;`, `&amp;`, `&#x27;`, numeric/hex entities) across titles, descriptions, tags, comments, danmaku, and creator bios.
- **Scale Verification:** Verified 498 unique videos in ~58s with 0 duplicates and 100% core field coverage.

#### v1.0.0 (2026-07)

- Initial release of Bilibili Scraper supporting keyword search (`EN` + `中文`), trending feed, direct video URLs, creator (`UP主`) profiles with `businessEmail` extraction, top comments, and XML danmaku bullet comments.

# Changelog

This Actor's version history is a separate document: https://apify.com/haketa/bilibili-scraper/changelog.md

# Actor input Schema

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

Find videos by keyword — English or Chinese (e.g. "python", "美食", "原神"). One keyword per line.

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

Scrape specific videos. Paste full URLs (https://www.bilibili.com/video/BV1xx...) or bare IDs (BV1xx... / av170001). One per line.

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

Get creator profiles — followers, bio, business email, verification. Paste space URLs (https://space.bilibili.com/123456) or bare IDs. One per line.

## `scrapePopular` (type: `boolean`):

Also pull the current Bilibili trending / popular feed.

## `popularCount` (type: `integer`):

How many trending videos to fetch when the option above is on.

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

Attach the top comments (sorted by likes) to each video.

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

Upper limit of comments collected for each video.

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

Attach danmaku — Bilibili's on-screen bullet comments — with their text and timestamp. Unique to Bilibili.

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

Upper limit of danmaku collected for each video.

## `searchPages` (type: `integer`):

How many result pages to pull per keyword (~42 videos per page). Set 0 for automatic scaling based on Max videos.

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

Ordering for keyword search.

## `maxVideos` (type: `integer`):

Overall cap on the number of videos to scrape across all keywords and sources. Set 0 for no limit (1,000+ supported).

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

How many videos to enrich in parallel. Higher finishes faster; lower is gentler. Recommended: 6–12.

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

Proxy settings. The default (Apify Proxy) works out of the box for every mode. Advanced users can override it.

## Actor input object example

```json
{
  "searchKeywords": [
    "原神",
    "机器学习"
  ],
  "videoUrls": [
    "https://www.bilibili.com/video/BV1GJ411x7h7"
  ],
  "userIds": [
    "https://space.bilibili.com/431073645"
  ],
  "scrapePopular": false,
  "popularCount": 30,
  "includeComments": false,
  "maxCommentsPerVideo": 20,
  "includeDanmaku": false,
  "maxDanmakuPerVideo": 200,
  "searchPages": 0,
  "searchOrder": "totalrank",
  "maxVideos": 40,
  "maxConcurrency": 8,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `datasetItems` (type: `string`):

Download every result (JSON, CSV, Excel).

## `runUrl` (type: `string`):

Open this run in the Apify Console.

## `recordType` (type: `string`):

video or creator

## `title` (type: `string`):

Video title

## `author` (type: `string`):

Creator name

## `views` (type: `string`):

Play count

## `danmakuCount` (type: `string`):

Bullet-comment count

## `likes` (type: `string`):

Like count

## `coins` (type: `string`):

Coins given

## `favorites` (type: `string`):

Favorite count

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

Reply count

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

Video category

## `publishedAt` (type: `string`):

Publish date

## `url` (type: `string`):

Video URL

## `name` (type: `string`):

Creator name (creator records)

## `followers` (type: `string`):

Follower count

## `businessEmail` (type: `string`):

Business email from bio

## `spaceUrl` (type: `string`):

Creator space URL

## `scrapedAt` (type: `string`):

ISO 8601 timestamp

# 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 = {
    "searchKeywords": [
        "python tutorial"
    ],
    "videoUrls": [],
    "userIds": [],
    "maxVideos": 40,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("haketa/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 = {
    "searchKeywords": ["python tutorial"],
    "videoUrls": [],
    "userIds": [],
    "maxVideos": 40,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("haketa/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 '{
  "searchKeywords": [
    "python tutorial"
  ],
  "videoUrls": [],
  "userIds": [],
  "maxVideos": 40,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call haketa/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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