# Bilibili Scraper - Video Search, Stats, Danmaku & Trending (`conversational_kermis/bilibili-scraper`) Actor

Bilibili (B站) videos by keyword, URL or trending: views, likes, coins, favourites, comment count, tags, upload date, creator followers and danmaku. $2 per 1,000 videos. Monitor mode returns only new uploads. For China market research and KOL discovery. No login.

- **URL**: https://apify.com/conversational_kermis/bilibili-scraper.md
- **Developed by:** [the anh nguyen](https://apify.com/conversational_kermis) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 71.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.60 / 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 Scraper - Video Search, Stats, Danmaku & Trending

Scrape **Bilibili** (哔哩哔哩, B站), China's largest video community, without a login: search videos by keyword, look up any video by URL, or pull the current **trending list** (热门). Every row is one video with its title, views, likes, coins, favourites, shares, comments, danmaku count, tags, upload date and creator (UP主), and optionally the creator's follower count and the video's **danmaku** (弹幕), the bullet comments that scroll over it.

Plain HTTP, no browser: the 20-video example input finishes in about 10 seconds.

### Why this one

- **No cookies to paste, no account.** The Actor visits Bilibili the way an anonymous browser does and signs its requests the same way the site does.
- **Exact numbers, not "1.2万".** Counts are integers (12,000, not 1.2万), durations are seconds, dates are ISO 8601 UTC.
- **Search filters that matter for research:** sort by relevance, most views, newest, most danmaku or most favourites, and limit to an upload-date range.
- **Pay for what you get.** A video whose details or danmaku could not be loaded is saved without them and not charged for them. Video URLs that do not exist are skipped and not charged.
- **Monitor mode.** Schedule a search with **Only new videos** on, and each run returns (and charges) only videos that earlier runs did not return: a feed of new uploads on a topic.
- **Honest about throttling.** Bilibili sometimes answers a busy server with an empty page. The Actor waits and retries those pages as a new visitor, and the run's status message says if a search stopped early.

### What you can use it for

- China market research: what is being watched and discussed about a brand, product, game or topic
- KOL / UP主 discovery: creators behind the most-viewed videos for a keyword, with follower counts
- Content and trend tracking: daily trending list, newest uploads for a keyword on a schedule
- Audience reaction analysis from danmaku (timed comments), for NLP or sentiment work
- Building Chinese video metadata datasets

### Input

| Field | Type | Description |
|-------|------|-------------|
| `queries` | array of strings | Search keywords, e.g. `人工智能`, `原神`, `iphone 17`. |
| `videoUrls` | array of strings | Video links (`bilibili.com/video/...`, `m.bilibili.com`, `b23.tv` short links) or bare `BV...` / `av...` ids. |
| `trending` | boolean | Also return the current trending list. Default `false`. |
| `sort` | string | `relevance`, `views`, `newest`, `danmaku` or `favorites`. Search only. Default `relevance`. |
| `dateFrom` / `dateTo` | date | Upload-date range, `YYYY-MM-DD`, China time. Search only. |
| `maxItems` | integer | Videos per query (and for trending), 1 to 1,000. Default `20`. Bilibili shows at most 1,000 results per search. |
| `fetchDetails` | boolean | Exact stats incl. coins and shares, the full tag list, original/repost and part count. One extra request per video. Always on for `videoUrls`. |
| `includeCreatorStats` | boolean | Creator followers, total likes, video count, verification and bio. Free. |
| `maxDanmaku` | integer | Add up to this many danmaku per video (0 = off). Turns on details. |
| `onlyNew` | boolean | Monitor mode: on repeat runs with the same search (query, sort, dates) or trending, return only videos not returned before. Default `false`. |
| `proxyConfiguration` | object | Optional. Runs work without a proxy. |

#### Most-viewed videos on a topic this month

```json
{
  "queries": ["人工智能"],
  "sort": "views",
  "dateFrom": "2026-11-01",
  "maxItems": 100,
  "fetchDetails": true,
  "includeCreatorStats": true
}
```

#### Specific videos with their danmaku

```json
{
  "videoUrls": ["https://www.bilibili.com/video/BV1jiWi6dEQg", "av170001"],
  "maxDanmaku": 500
}
```

#### Today's trending list

```json
{
  "trending": true,
  "maxItems": 100
}
```

#### New uploads on a topic, every hour

Schedule this input. The first run returns the newest 50; each later run returns only videos uploaded (or newly found) since. A run with nothing new succeeds with an empty dataset and costs nothing in results.

```json
{
  "queries": ["机器人"],
  "sort": "newest",
  "maxItems": 50,
  "onlyNew": true
}
```

### Output

One row per video. Example (search with details and creator stats, danmaku shortened):

```json
{
  "source": "search",
  "query": "原神",
  "position": 1,
  "bvid": "BV1jiWi6dEQg",
  "aid": 117608754190213,
  "url": "https://www.bilibili.com/video/BV1jiWi6dEQg",
  "title": "《原神》剧情PV-「被赋予的慈爱」",
  "description": "神降下它能带来的慈爱，为世间众生解除万千的苦痛。…",
  "cover": "https://i1.hdslb.com/bfs/archive/109430d5f063be93576b5d38e529985786683183.jpg",
  "durationSeconds": 518,
  "publishedAt": "2026-11-14T04:00:00Z",
  "category": "手机游戏",
  "tags": ["至冬", "安娜丝塔夏", "米哈游", "miHoYo", "原神"],
  "views": 527914,
  "likes": 77768,
  "coins": 20185,
  "favorites": 12505,
  "shares": 2511,
  "comments": 2205,
  "danmakuCount": 1277,
  "historyRank": 80,
  "copyright": "original",
  "partCount": 1,
  "authorName": "原神",
  "authorId": 401742377,
  "authorUrl": "https://space.bilibili.com/401742377",
  "authorFollowers": 20967639,
  "authorLikes": 291023140,
  "authorVideoCount": 760,
  "authorVerified": "原神官方账号",
  "detailsStatus": "ok",
  "danmaku": [
    { "time": 62.05, "text": "以乐景衬哀情", "sentAt": "2026-11-14T04:02:53Z", "mode": "top", "color": "#ffffff" }
  ],
  "scrapedAt": "2026-11-17T21:40:00Z"
}
```

Fields that only some options fill:

- `coins`, `shares`, `copyright`, `partCount`: with details on (and on trending rows, which carry coins and shares).
- `author*` counts and bio: with creator stats on.
- `danmaku`: with `maxDanmaku` above 0.
- `trendingReason`: trending rows, e.g. `百万播放` (a million plays).
- `changeType`: `"new"` on every row in monitor mode.

The dataset has four views: Videos, Engagement, Creators and Danmaku.

### Use it from Python

```bash
pip install apify-client pandas
```

The most-viewed videos on a topic this month, with a creator shortlist:

```python
from apify_client import ApifyClient
import pandas as pd

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("conversational_kermis/bilibili-scraper").call(run_input={
    "queries": ["人工智能"],
    "sort": "views",
    "dateFrom": "2026-11-01",
    "maxItems": 100,
    "fetchDetails": True,
    "includeCreatorStats": True,
})
df = pd.DataFrame(client.dataset(run["defaultDatasetId"]).iterate_items())
print(df[["title", "authorName", "authorFollowers", "views", "likes", "coins"]].head(10))

creators = (
    df.groupby(["authorName", "authorUrl", "authorFollowers"])
      .agg(videos=("bvid", "count"), total_views=("views", "sum"))
      .sort_values("total_views", ascending=False)
)
print(creators.head(20))
```

Where viewers reacted in a video: every danmaku has its time in the video, so 10-second bins show the peaks.

```python
run = client.actor("conversational_kermis/bilibili-scraper").call(run_input={
    "videoUrls": ["https://www.bilibili.com/video/BV1jiWi6dEQg"],
    "maxDanmaku": 500,
})
video = next(client.dataset(run["defaultDatasetId"]).iterate_items())
dm = pd.DataFrame(video["danmaku"])
print(dm.groupby((dm.time // 10) * 10).size().sort_values(ascending=False).head(5))
```

### Pricing

Pay per event, no start fee:

| Event | Price | When |
|-------|-------|------|
| `video` | $0.002 | every video row saved |
| `video-details` | $0.002 | every row whose details were loaded (`detailsStatus: "ok"`) |
| `danmaku` | $0.003 | every row saved with at least one danmaku (videos with none are not charged) |

1,000 search results cost $2; with details $4. Creator stats are free. Set a maximum cost per run in the run options and the Actor stops there.

### Limits, plainly

- **Comments and subtitles are not included.** Bilibili shows a visitor who is not logged in only the top 3 comments of a video, and no subtitles (none on 20 of 20 trending videos tested on 2026-11-22); this Actor does not log in. The comment *count* is in every row.
- **A creator's full video list is not included** for the same reason. Search for the creator's name, or pass their video URLs.
- **Danmaku can run out partway through a big run.** Bilibili stops serving danmaku to a server that asks for many in a row. The Actor then saves the remaining videos without danmaku, does not charge for them, and says so in the status message. A proxy (residential works best) avoids it.
- **Monitor mode remembers videos, not their numbers.** A video returned once is not returned again, even if its views grow. Memory is per search (query, sort and dates) or trending, kept in a key-value store named `bilibili-scraper-seen` in your own account.
- **Search tops out at 1,000 results** per query (50 pages), which is Bilibili's own limit. Split a broad topic into narrower queries or date ranges for more.
- **Throttled pages are retried, not skipped.** Under load Bilibili answers some search pages with nothing. The Actor waits and retries them as a new anonymous visitor. If a page still comes back empty after six tries, that query stops there and the run says so.

### FAQ

**Do I need a Bilibili account or cookies?** No.

**Can I schedule it?** Yes. A daily run with `sort: "newest"` and a one-day `dateFrom` gives you every new upload for your keywords.

**Is this legal?** The Actor reads public pages that anyone can open without logging in. You are responsible for how you use the data; check Bilibili's terms and the laws that apply to you, especially for personal data.

**Something broke?** Open an issue on the Issues tab with the run link and I will look at it.

# Actor input Schema

## `queries` (type: `array`):

Keywords to search Bilibili videos for, one per line, in Chinese or any other language, e.g. 人工智能, 原神 or iphone 17.

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

Bilibili video links (www.bilibili.com/video/..., m.bilibili.com, b23.tv short links) or bare BV / av ids. Each one is returned with full details.

## `trending` (type: `boolean`):

Also return Bilibili's current popular list (热门), up to Max videos.

## `sort` (type: `string`):

relevance: Bilibili's default ranking (综合排序). views: most played. newest: latest uploads. danmaku: most danmaku. favorites: most favourited.

## `dateFrom` (type: `string`):

Search only: videos uploaded on or after this day (China time). Leave empty for no lower limit.

## `dateTo` (type: `string`):

Search only: videos uploaded on or before this day (China time). Leave empty for up to today.

## `maxItems` (type: `integer`):

Stop after this many videos for each search query (and for the trending list). Bilibili shows at most 1,000 results per search.

## `fetchDetails` (type: `boolean`):

Open each search or trending video for its exact stats (views, likes, coins, favourites, shares, comments, danmaku), full tag list, original/repost flag and part count. Search alone has no coins or shares. One extra request per video. Always on for Video URLs.

## `includeCreatorStats` (type: `boolean`):

Add each video's creator follower count, total likes, video count, verification and bio. One request per distinct creator, free of charge.

## `maxDanmaku` (type: `integer`):

Add up to this many danmaku (弹幕, the bullet comments over the video) to each video: time in the video, text, sent time, position and colour. 0 = none. Bilibili serves the most recent ones, typically up to 500-3,000 per video. Turns on video details.

## `onlyNew` (type: `boolean`):

On repeat runs with the same search (query, sort and dates) or trending, return only videos not returned before. Schedule it with sort "newest" for a feed of new uploads on a topic. The first run returns everything and remembers it; memory is per search, in your own Apify account. Video URLs are always returned.

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

Optional. Runs work without a proxy; use one if Bilibili keeps throttling your runs.

## Actor input object example

```json
{
  "queries": [
    "人工智能"
  ],
  "trending": false,
  "sort": "relevance",
  "maxItems": 20,
  "fetchDetails": false,
  "includeCreatorStats": false,
  "maxDanmaku": 0,
  "onlyNew": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `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 = {
    "queries": [
        "人工智能"
    ],
    "maxItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("conversational_kermis/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 = {
    "queries": ["人工智能"],
    "maxItems": 20,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("conversational_kermis/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 '{
  "queries": [
    "人工智能"
  ],
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call conversational_kermis/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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