# Bilibili Scraper (B站): Video Search, Rankings & 弹幕 Analytics (`den_den/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩 / B站) videos: keyword search past the 1,000-result cap, popular and ranking lists with rank movement, video stats and engagement rates, growth tracker, creator uploads, anonymous danmaku (弹幕) analytics, hot searches. No login. No comments or profiles.

- **URL**: https://apify.com/den_den/bilibili-scraper.md
- **Developed by:** [Mr Putra](https://apify.com/den_den) (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 $1.50 / 1,000 video saveds

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 (B站): Video Search, Rankings & 弹幕 Analytics

Get Bilibili (哔哩哔哩 / B站) video data as JSON, CSV or Excel: keyword search that splits date ranges to get past Bilibili's 1,000-result cap, popular and category rankings with rank movement, and full stats with engagement rates on every row. It also tracks growth on videos you list, summarizes a creator's uploads and builds anonymous danmaku (弹幕) reaction curves. It does not collect comments or user profiles.

**Use cases**

- Brands and China-market agencies: find every video on your keyword and compare engagement.
- Campaign managers: run daily on sponsored videos to see views, likes and coins gained since the last check.
- Trend researchers: follow popular and ranking lists and see which videos are climbing.

**Sample output**

```json
{
  "bvid": "BV1xrnz6gEVD",
  "title": "折1万次，会坏吗？iPhone Duo深度评测",
  "authorName": "影视飓风",
  "durationSeconds": 1492,
  "views": 5664762,
  "likes": 298768,
  "coins": 154677,
  "favorites": 58896,
  "danmakuCount": 70534,
  "likeRate": 0.05274,
  "interactionRate": 0.0971,
  "viewsPerDay": 3068707
}
```

**Price:** 1,000 videos cost $1.50, plus $0.001 per run. Danmaku analytics add $3.00 per 1,000 videos, only when turned on. Hot searches and creator summaries are free.

### Why this one

- **Full coverage:** Bilibili stops every search at 1,000 results. Full coverage splits the date range automatically, so a busy term like 咖啡 returns every video (about 600 a day), not just the first 1,000.
- **Engagement metrics on every row:** like, coin and favorite rates, total interaction rate, views per day and danmaku per minute, with no extra cost.
- **Campaign tracker:** list your sponsored videos, schedule a daily run, and get views, likes and coins gained since the last check.
- **Rank movement:** popular and ranking rows show the previous rank, places moved and new entries.
- **You never pay for duplicates:** Bilibili repeats videos across search pages; repeats are removed before saving.
- **Honest failures:** if Bilibili refuses requests, the run stops and is marked Failed instead of quietly returning less.

### Modes

| Mode | Input | Returns |
| --- | --- | --- |
| Search | Search terms; sort (relevance, views, newest, danmaku, favorites, comments), length and date filters; optional Full coverage | Videos, repeats removed |
| Popular now (热门) | — | The live popular feed with `rank`, `previousRank`, `rankChange`, `isNewEntry` |
| Ranking (排行榜) | One or more categories | The current top 100 per category, with rank movement |
| Video details / campaign tracker | Video links, b23.tv short links or BV/av ids; optional Track growth | Full stats per video, and gains since the previous run when tracking |
| Creator videos (UP主) | Creator ids or space links | The creator's uploads, newest first, plus a free performance summary row |
| Hot search terms (热搜) | — | Bilibili's 50 trending search terms with heat score (free) |

Ranking categories: all, animation, music, dance, gaming, knowledge, tech, sports, cars, life, food, animals, fashion, entertainment, film & TV, kichiku.

**Add-ons**

- **Full video stats:** search and creator lists carry basic counts; turn this on for coins, shares, the full description and complete metrics (one extra request per video, no extra charge).
- **Danmaku analytics ($0.003 per video):** one anonymous row per video: danmaku per minute, a minute-by-minute reaction curve, the peak moments and phrases repeated by at least 3 viewers. No sender data, no single messages, and phrases with @mentions, uids or long numbers are dropped.
- **New videos only (monitor):** remembers videos from earlier runs with the same key, so a scheduled search or list saves, and charges for, only new videos.

Dates accept `2026-10-01` or relative values like `7 days`, `3 months`, `1 year`.

### Input examples

Every coffee video of the last 30 days, with metrics:

```json
{
    "mode": "search",
    "searchQueries": ["咖啡"],
    "fullCoverage": true,
    "publishedAfter": "30 days",
    "maxResults": 50000
}
```

Daily campaign tracker:

```json
{
    "mode": "video_detail",
    "videoUrls": ["https://www.bilibili.com/video/BV1pGnn67EbB", "https://b23.tv/BV1hD4y1X7Rm"],
    "trackChanges": true,
    "trackKey": "autumn-campaign"
}
```

### Output

A video row (search rows have the same fields; coins and shares need Full video stats):

```json
{
    "type": "video",
    "bvid": "BV1pGnn67EbB",
    "url": "https://www.bilibili.com/video/BV1pGnn67EbB",
    "title": "带着100万，我们见了成人网红...",
    "durationSeconds": 2682,
    "publishedAt": "2026-10-18T06:20:00+00:00",
    "category": "社会观察",
    "authorName": "影视飓风",
    "authorMid": 946974,
    "views": 4476108,
    "likes": 333217,
    "coins": 243885,
    "favorites": 111107,
    "shares": 69622,
    "danmakuCount": 37677,
    "commentCount": 7766,
    "likeRate": 0.07444,
    "coinRate": 0.05449,
    "interactionRate": 0.1693,
    "viewsPerDay": 1492036,
    "danmakuPerMinute": 842.89,
    "source": "popular",
    "rank": 1,
    "previousRank": 4,
    "rankChange": 3,
    "isNewEntry": false
}
```

The campaign tracker adds `viewsGained`, `likesGained`, `coinsGained`, `favoritesGained`, `sharesGained`, `commentCountGained`, `danmakuCountGained`, `hoursSinceLastCheck` and `viewsPerDaySinceLastCheck`.

A danmaku analytics row:

```json
{
    "type": "danmaku_analytics",
    "videoBvid": "BV1xrnz6gEVD",
    "danmakuTotalOnVideo": 15353,
    "danmakuAnalyzed": 3600,
    "perMinute": 144.77,
    "reactionCurve": [210, 95, 88, 1845],
    "peakMoments": [{"minute": 3, "count": 1845}],
    "topPhrases": [{"text": "冒泡", "count": 1493}]
}
```

A creator summary row (computed from the videos scraped): `videosOnChannel`, `videosAnalyzed`, `avgViews`, `medianViews`, `maxViews`, `avgInteractionRate`, `uploadsPerWeek`, `latestUploadAt`. The dataset has a view per row type.

### Pricing

| Event | Price |
| --- | --- |
| Video | $0.0015 ($1.50 per 1,000) |
| Danmaku analytics (optional add-on) | $0.003 per analysed video |
| Run start | $0.001 per run |
| Creator summary rows, hot search terms | free |

No monthly fee. Examples: 1,000 search results = $1.501; the overall top 100 = $0.151; the top 100 with danmaku analytics = $0.451; a daily tracker of 20 campaign videos = $0.031 per day.

### Limits

- **Search depth without Full coverage:** at most 50 pages (1,000 results) per term, usually 700–900 unique after repeats are removed.
- **Danmaku:** Bilibili's public track holds up to a pool limit per video (often a few thousand of the newest), so `danmakuAnalyzed` can be lower than `danmakuTotalOnVideo`.
- **No comments or user profiles.** The Actor collects video-level data and anonymous aggregates only.
- **Rank movement and tracking** start from the second run with the same list or Track key.
- **If Bilibili refuses requests,** the run pauses once, retries once, then stops and is marked **Failed** with a message, so a short result is never shown as complete. Try again later.

### FAQ

**Do I need a Bilibili account, cookie or proxy?** No.

**How fresh is the data?** Live: every run reads Bilibili at that moment. Schedule the Actor for a daily or hourly series.

**Can I search in English?** Yes, but Chinese terms return far more. Add both as separate terms, e.g. `Nike` and `耐克`.

**Where do I find ids?** Video: `bilibili.com/video/BV1pGnn67EbB` → `BV1pGnn67EbB`. Creator: `space.bilibili.com/946974` → `946974`. Full links and b23.tv short links work too.

### Responsible use

The Actor reads public video pages and lists that anyone can see without logging in, identifies itself in its User-Agent, and keeps a gentle request rate. It collects no comments and no personal profiles; uploader names and ids appear only as the public author of each video, and danmaku are reported only as anonymous aggregates.

# Actor input Schema

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

Search: videos for your search terms. Popular / Ranking: Bilibili's trending lists with rank movement. Video details: stats for your videos, optionally tracking growth between runs. Creator videos: a creator's uploads plus a performance summary. Hot search terms: what people search right now (free).

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

Keywords to search, each searched separately. Chinese works best (咖啡, 人工智能); add English or brand variants as extra terms (Nike, 耐克).

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

Order of video search results.

## `durationFilter` (type: `string`):

Only videos of this length (video search only).

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

Only videos published on or after this date (YYYY-MM-DD) or within a relative period such as "7 days", "3 months" or "1 year".

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

Only videos published on or before this date (YYYY-MM-DD).

## `fullCoverage` (type: `boolean`):

Bilibili stops at 1,000 results per search. Turn on to split the date range (default: last 30 days) into windows small enough to get every matching video, newest first. Sort is then by newest.

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

Video links, b23.tv short links or IDs (BV1xx411c7mD, av170001), for Video details.

## `trackChanges` (type: `boolean`):

Video details only: remember each video's stats and add the views, likes, coins and other counts gained since the previous run with the same Track key. Schedule it daily to follow a campaign.

## `trackKey` (type: `string`):

Name of the saved stats for growth tracking. Use one key per campaign or video list.

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

Creator IDs or space links (https://space.bilibili.com/946974), for Creator videos.

## `includeCreatorSummary` (type: `boolean`):

Creator videos only: add one free row per creator with average and median views, upload frequency and latest upload, computed from the videos scraped.

## `rankingCategories` (type: `array`):

Categories for Ranking mode, each a separate top-100 list. Leave empty for the overall ranking.

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

Maximum videos per search term, per creator, or per list. With Full coverage a term can return many thousands.

## `enrichVideos` (type: `boolean`):

Search and Creator videos return basic counts only. Turn on to add coins, shares, the full description and complete engagement metrics (one extra request per video, no extra charge).

## `includeDanmakuAnalytics` (type: `boolean`):

Add one anonymous analytics row per video ($0.003 per analysed video): danmaku (弹幕) per minute, a minute-by-minute reaction curve, peak moments and phrases repeated by at least 3 viewers. No sender data, no single messages, and phrases with @mentions, uids or long numbers are dropped.

## `monitorMode` (type: `boolean`):

Skip videos returned by earlier runs with the same Monitor key, so a scheduled run gives only new videos and you pay only for those.

## `monitorKey` (type: `string`):

Name of the saved list of seen videos. Use a different key per list you track.

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "咖啡"
  ],
  "sortBy": "relevance",
  "durationFilter": "any",
  "fullCoverage": false,
  "trackChanges": false,
  "trackKey": "default",
  "includeCreatorSummary": true,
  "rankingCategories": [
    "all"
  ],
  "maxResults": 100,
  "enrichVideos": false,
  "includeDanmakuAnalytics": false,
  "monitorMode": false,
  "monitorKey": "default"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset with one row per video, user, comment or danmaku profile

# 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 = {
    "searchQueries": [
        "咖啡"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("den_den/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 = { "searchQueries": ["咖啡"] }

# Run the Actor and wait for it to finish
run = client.actor("den_den/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 '{
  "searchQueries": [
    "咖啡"
  ]
}' |
apify call den_den/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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