# Bilibili Video Scraper (`flarewow/bilibili-video-scraper`) Actor

Scrape Bilibili (哔哩哔哩 / B站) videos by keyword, the popular board or video URL: views, likes, coins, favorites, shares, danmaku, comments, tags, uploader. No login. $3.50 per 1,000 videos.

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

## Pricing

$3.50 / 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 Video Scraper (哔哩哔哩 / B站)

**Bilibili Video Scraper extracts public Bilibili videos – search results, the popular (热门) board and full stats for any video URL – into clean JSON, CSV or Excel. No login, no cookies, $3.50 per 1,000 videos.**

### What can you use it for?

- **Market & trend research in China** – see which products, games, brands and topics get views, likes and danmaku on B站.
- **Influencer & KOL discovery** – find the uploaders (UP主) behind the most-watched videos for a keyword.
- **Brand monitoring** – track new videos about your brand or competitors, sorted by newest.
- **Content strategy** – compare titles, durations, tags and engagement of top videos in your niche.
- **AI / LLM pipelines** – feed structured video data (titles, descriptions, tags, stats) to your agents.

### What data do you get?

| Field | Description |
|---|---|
| `bvid`, `aid`, `url` | Video id (BV…), numeric id and link |
| `title`, `description`, `tags` | Text of the video (HTML highlighting removed) |
| `coverUrl` | Cover image (HTTPS) |
| `durationSec` | Duration in seconds |
| `publishedAt` | Publish time (ISO 8601, UTC) |
| `views`, `likes`, `danmaku`, `comments`, `favorites`, `coins`, `shares` | Engagement numbers (coins & shares: popular, video URLs, or search with *Add full stats*) |
| `category` | Bilibili category (e.g. 汽车, 游戏) |
| `authorName`, `authorId`, `authorUrl` | Public channel of the uploader |
| `source`, `searchQuery`, `rank` | How the video was found and its position |
| `scrapedAt` | When the row was collected |

### How to use it

1. Choose **What to scrape**: *Search videos by keyword*, *Popular / trending videos* or *Video details from URLs*.
2. Enter keywords (Chinese or English work) or video links.
3. Set **Max videos per keyword** and, for search, the **sort order** (best match, most views, newest, most danmaku, most favorites).
4. Click **Start** and download the results as JSON, CSV, Excel or HTML – or get them through the API.

#### Example input

```json
{
  "mode": "search",
  "searchQueries": ["tesla model y"],
  "maxResultsPerQuery": 20,
  "sortBy": "totalrank",
  "includeDetails": true
}
```

#### Example output (one item, uploader anonymised)

```json
{
  "bvid": "BV1s2421c7zm",
  "aid": 1600435225,
  "url": "https://www.bilibili.com/video/BV1s2421c7zm",
  "title": "开箱特斯拉 Model Y",
  "description": null,
  "coverUrl": "https://i1.hdslb.com/bfs/archive/7660ce99551c8f7914102702bed64e192ed3133d.jpg",
  "durationSec": 529,
  "publishedAt": "2024-02-04T12:34:25.000Z",
  "views": 111473,
  "danmaku": 25,
  "likes": 297,
  "coins": 40,
  "favorites": 832,
  "shares": 14,
  "comments": 25,
  "category": "模玩·周边",
  "tags": ["玩具", "模玩跨年总动员", "汽车模型", "开箱", "我要做模王！", "模型"],
  "authorName": "Example UP主",
  "authorId": 123456789,
  "authorUrl": "https://space.bilibili.com/123456789",
  "source": "search",
  "searchQuery": "tesla model y",
  "rank": 3,
  "scrapedAt": "2026-10-28T19:39:09.786Z"
}
```

#### API (JavaScript)

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('flarewow/bilibili-video-scraper').call({ mode: 'search', searchQueries: ['原神'], maxResultsPerQuery: 50 });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

#### API (Python)

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("flarewow/bilibili-video-scraper").call(run_input={"mode": "popular", "maxResultsPerQuery": 100})
items = client.dataset(run["defaultDatasetId"]).list_items().items
```

### Pricing

**$3.50 per 1,000 videos** (pay per result, $0.0035 per video) plus a tiny Apify start fee. You pay only for videos saved to the dataset – failed or empty runs cost nothing for results. *Add full stats* does not change the price.

### Limits & FAQ

- **How many results per keyword?** Bilibili search returns up to ~1,000 videos (50 pages × 20) per keyword; use several keywords or sort orders for more.
- **Popular board:** up to ~1,000 videos from 热门.
- **Comments and danmaku text** are not collected (they contain data of private users).
- **Deleted, private or region-locked videos** are reported in the run's `ERRORS` record and skipped.
- **Blocked requests** are retried automatically with a new session. If nothing could be scraped, the run **fails with a clear message** instead of finishing "successful" with an empty dataset.
- **Proxy:** Apify Proxy (datacenter) is used by default; video detail pages automatically use residential IPs because Bilibili blocks datacenter IPs there.

### Integrations

Works with **Make, Zapier, n8n**, Google Sheets, Slack, webhooks and the **Apify MCP server** (use it as a tool in Claude, ChatGPT or your own AI agent). Schedule it to monitor new videos for your keywords daily.

### Responsible use

The actor collects only publicly available video information and public channel names/links of uploaders. It does not log in, does not collect comments or private-user data, and does not bypass CAPTCHAs. Use the data in line with Bilibili's terms and the laws that apply to you (e.g. GDPR, PIPL).

***

### 中文说明

**B站视频采集器**：按关键词搜索视频、采集热门榜、或根据视频链接获取完整数据（播放、点赞、投币、收藏、分享、弹幕、评论数、标签、UP主公开主页）。**无需登录、无需 Cookie**，结果可导出为 JSON / CSV / Excel，价格 **每 1000 条视频 3.5 美元**。

| 字段 | 含义 |
|---|---|
| `bvid` / `url` | BV号 / 视频链接 |
| `title` / `description` / `tags` | 标题 / 简介 / 标签 |
| `views` / `likes` / `coins` / `favorites` / `shares` | 播放 / 点赞 / 投币 / 收藏 / 分享 |
| `danmaku` / `comments` | 弹幕数 / 评论数 |
| `durationSec` / `publishedAt` | 时长（秒）/ 发布时间 |
| `category` | 分区 |
| `authorName` / `authorUrl` | UP主名称 / 主页 |

使用方法：选择模式（关键词搜索 / 热门 / 视频链接）→ 输入关键词或链接 → 设置每个关键词的数量和排序（综合排序、最多播放、最新发布、最多弹幕、最多收藏）→ 运行。仅采集公开数据，不采集评论内容和普通用户的个人信息。

# Actor input Schema

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

search = videos matching your keywords; popular = Bilibili's current popular board; videos = full stats for specific video URLs.

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

Keywords to search on Bilibili (Chinese or English), e.g. 原神, iphone 16, AI. Used in mode 'search'.

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

Bilibili video links (https://www.bilibili.com/video/BV...) or plain BV ids. Used in mode 'videos'.

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

How many videos to return for each keyword (Bilibili search shows at most ~1000 per keyword) or from the popular board.

## `sortBy` (type: `string`):

Order of search results. Used in mode 'search'.

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

Fetch each video's page data to add coins, shares and exact likes to search results. Slower (one extra request per video), same price.

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

Apify Proxy (datacenter) works well for Bilibili. Switch to RESIDENTIAL only if you see many blocked requests.

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "iphone 16"
  ],
  "videoUrls": [
    "https://www.bilibili.com/video/BV1GJ411x7h7"
  ],
  "maxResultsPerQuery": 20,
  "sortBy": "totalrank",
  "includeDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

## `errors` (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 = {
    "mode": "search",
    "searchQueries": [
        "iphone 16"
    ],
    "videoUrls": [
        "https://www.bilibili.com/video/BV1GJ411x7h7"
    ],
    "maxResultsPerQuery": 20,
    "sortBy": "totalrank",
    "includeDetails": false,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("flarewow/bilibili-video-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 = {
    "mode": "search",
    "searchQueries": ["iphone 16"],
    "videoUrls": ["https://www.bilibili.com/video/BV1GJ411x7h7"],
    "maxResultsPerQuery": 20,
    "sortBy": "totalrank",
    "includeDetails": False,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("flarewow/bilibili-video-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 '{
  "mode": "search",
  "searchQueries": [
    "iphone 16"
  ],
  "videoUrls": [
    "https://www.bilibili.com/video/BV1GJ411x7h7"
  ],
  "maxResultsPerQuery": 20,
  "sortBy": "totalrank",
  "includeDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call flarewow/bilibili-video-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,flarewow/bilibili-video-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/wvxBiz3VaOzF4bnVq/builds/GvTCe1IVKG9PjZxBG/openapi.json
