# Bilibili Video Scraper (哔哩哔哩 B站) - Search & Trending (`monkeypatcher/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩 / B站) videos by keyword with the site's own filters, or get the Trending (热门) list: views, likes, favorites, comments, danmaku, coins, shares, tags, category, duration and publish date. No login, no cookies.

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

## Pricing

from $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.
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 Video Scraper (哔哩哔哩 B站) — Search & Trending

Get Bilibili (哔哩哔哩 / B站) video data without an account: **search by keyword** with the same filters as the Bilibili search page, or take the current **Trending (热门)** list. Every video comes with its public stats, tags, category, length and publish date, ready to export to Excel, CSV or JSON, or to pull from the API. No login, no cookies.

### What you get for each video

| Field | Description |
|---|---|
| `title`, `description` | Clean text, without the search highlighting |
| `url`, `bvid`, `aid` | Video link and IDs |
| `author`, `authorId`, `authorUrl` | The channel that published it, as shown next to the video |
| `views`, `likes`, `favorites`, `comments`, `danmaku` | Public counters (danmaku = bullet comments) |
| `coins`, `shares` | Trending mode only (the search page does not show them) |
| `category`, `tags` | Bilibili category and the video's tags (search mode) |
| `durationSeconds`, `publishedAt` | Length in seconds and publish date (ISO 8601, UTC) |
| `coverUrl` | Cover image link |
| `keyword`, `position`, `source` | Which search found it and where it ranked |

### What people use it for

- **China market research**: what gets watched in a category, which products and brands come up, how fast a topic grows.
- **Influencer (UP主) discovery**: find the channels that rank for your keywords, with their views and engagement.
- **Trend tracking**: schedule the Trending mode every day and keep the history.
- **Content research**: titles, tags and lengths that work for a topic.
- **Datasets**: structured video metadata for analysis or AI projects.

### How to use it

**Search** — one search per keyword, up to 1,000 videos each:

```json
{
  "mode": "search",
  "keywords": ["机械键盘", "iPhone 17"],
  "maxResultsPerKeyword": 200,
  "sortBy": "views",
  "duration": "any",
  "publishedAfter": "2026-10-01"
}
```

Sort options: `relevance`, `views`, `newest`, `danmaku`, `favorites`. Length filter: `any`, `under10`, `10to30`, `30to60`, `over60`. Dates are days in China time.

**Trending** — the 热门 list, with coins and shares:

```json
{
  "mode": "popular",
  "maxTrending": 200
}
```

### How much does it cost?

You pay per video saved to the dataset, plus a small fee when each run starts (the **Pricing** tab shows the exact price for your Apify plan). At the list price of **$5 per 1,000 videos**:

| Videos | Cost |
|---|---|
| 100 | about $0.50 |
| 1,000 | about $5 |
| 10,000 | about $50 |

Set a **maximum cost per run** when you start it and the scraper stops when it reaches that amount, keeping everything saved so far. Videos that are not saved are never charged.

### Use it from the API

The **API** tab has ready-made code for Python, Node.js and cURL. In Python, with the `apify-client` package:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("monkeypatcher/bilibili-scraper").call(run_input={
    "mode": "search",
    "keywords": ["机械键盘"],
    "maxResultsPerKeyword": 100,
    "sortBy": "views",
})
for video in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(video["title"], video["views"], video["url"])
```

### Output example

```json
{
  "bvid": "BV1xx411c7mD",
  "url": "https://www.bilibili.com/video/BV1xx411c7mD",
  "title": "【2026键盘推荐】机械键盘全价位清单",
  "author": "示例频道",
  "authorId": 12345678,
  "category": "数码",
  "tags": ["机械键盘", "数码", "键盘推荐"],
  "views": 759902,
  "likes": 7454,
  "favorites": 3318,
  "comments": 1927,
  "danmaku": 447,
  "coins": null,
  "shares": null,
  "durationSeconds": 1706,
  "publishedAt": "2026-10-22T11:53:00Z",
  "coverUrl": "https://i0.hdslb.com/bfs/archive/example.jpg",
  "source": "search",
  "keyword": "机械键盘",
  "position": 1
}
```

### FAQ

**Do I need a Bilibili account or cookies?**
No. It opens Bilibili like a normal visitor and reads what the page shows.

**How many videos can I get?**
Up to about 1,000 per search, which is Bilibili's own limit (24 pages of 42). To go further, split one search into several with the date, sort or length filters. The Trending mode goes up to 500 videos, or as many as Bilibili lists that day.

**Why are `coins` and `shares` empty in search mode?**
The Bilibili search page does not show them. The Trending mode returns them for every video.

**Are titles translated?**
No. Titles, descriptions and tags come exactly as they are on Bilibili, usually in Chinese.

**What happens if Bilibili asks for a verification?**
The run stops and keeps every video already saved. It never tries to solve captchas. If that happens before the first video, the run ends with an error and no videos are charged (only the run start). Try again later or switch the proxy to the residential group.

**What data does it collect?**
Public video data only, plus the channel name and ID shown next to each video. It does not collect comments, user profiles, avatars or locations, and it does not download videos. You are responsible for using the data in line with Bilibili's terms and the laws that apply to you.

**Can I schedule it or connect it to other tools?**
Yes. Schedule runs in Apify, call it from the API, or connect it to Google Sheets, n8n, Make or Zapier.

### Feedback

Missing a field or a filter? Open an issue on the Issues tab and it will be looked at.

# Actor input Schema

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

Search videos by keyword, or get the current Trending (热门) list.

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

One search per keyword. Chinese keywords return the most results (e.g. 机械键盘), but any language works.

## `maxResultsPerKeyword` (type: `integer`):

Bilibili shows at most about 1,000 results per search. To get more, split the search with the sort, duration or date filters.

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

Same options as the Bilibili search page.

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

Filter by video length.

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

Only videos published on or after this day (China time).

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

Only videos published on or before this day (China time).

## `maxTrending` (type: `integer`):

Only for the Trending mode.

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

Apify Proxy is recommended. If Bilibili asks for a verification, try the residential group.

## Actor input object example

```json
{
  "mode": "search",
  "keywords": [
    "机械键盘"
  ],
  "maxResultsPerKeyword": 50,
  "sortBy": "relevance",
  "duration": "any",
  "maxTrending": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One row per video, in the order Bilibili listed them.

# 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": [
        "机械键盘"
    ]
};

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

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

```

## MCP server setup

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