# Bilibili Scraper - Videos, Stats, Creators, Comments (`unbrowseai/bilibili-scraper`) Actor

Scrape Bilibili (B站) videos by keyword, creator (UP主) uploads, Popular or Ranking, or video URLs/BV ids: title, author, followers, publish date, duration, views, likes, coins, favorites, shares, danmaku, replies, tags. Optional comments. Half the usual price.

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

## Pricing

from $10.00 / 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 – Videos, Stats, Creators (UP主) and Comments

Get Bilibili (B站) videos as clean, structured data. Search by keyword, pull every upload from a creator (UP主), take the site-wide Popular feed or the daily Ranking top 100, or look up single videos by URL, BV id or av id. Every video comes with its full engagement numbers: views, likes, coins, favorites, shares, danmaku (bullet comments) and replies, plus the creator's follower count, tags, category, duration and publish date. Comments are optional.

中文说明：按关键词、UP主、热门或排行榜抓取B站视频及完整数据（播放、点赞、投币、收藏、分享、弹幕、评论、标签、粉丝数），可选抓取评论。

### What people use it for

- **Influencer and KOL research** – find the creators that matter in a niche, compare their views, coins and follower counts before a campaign.
- **Brand and product monitoring** – track what Chinese audiences publish and say about a brand, game or product, with comments for sentiment work.
- **Trend spotting** – snapshot the Popular feed and the Ranking every day and see what rises.
- **Content strategy** – benchmark titles, durations, tags and publishing times against the videos that perform best.
- **Academic and market research** – build datasets of Chinese online video for analysis.

### How to use it

1. Enter one or more **search keywords** (Chinese works best, e.g. `原神`, `人工智能`), and/or
2. Add **creators** by UID (`546195`) or space URL (`https://space.bilibili.com/546195`), and/or
3. Pick **Popular now** or **Ranking top 100**, and/or
4. Paste **video URLs or BV ids** (`BV1fwh96bEfH`, `https://www.bilibili.com/video/BV1...`, `av170001`, b23.tv links).
5. Set **Max videos per source**. Turn on **Include comments** if you need them.
6. Run, then download JSON, CSV or Excel, or read the dataset through the API.

Keyword search can be sorted by relevance, most viewed, newest, most danmaku or most favorited. Creator uploads come newest first.

### Output example

```json
{
  "type": "video",
  "bvid": "BV1fwh96bEfH",
  "aid": 117335587295448,
  "url": "https://www.bilibili.com/video/BV1fwh96bEfH",
  "title": "《三角洲行动》群星计划—代号：蝶",
  "description": "命运给她的时间，比任何人都要短。…",
  "authorName": "三角洲行动",
  "authorMid": 3494376565115651,
  "authorUrl": "https://space.bilibili.com/3494376565115651",
  "authorFollowers": 4852731,
  "pubdate": "2026-09-26T15:58:40.000Z",
  "durationSeconds": 245,
  "view": 925054,
  "like": 60531,
  "coin": 8044,
  "favorite": 14435,
  "share": 4310,
  "danmaku": 964,
  "reply": 3226,
  "cover": "https://i2.hdslb.com/bfs/archive/bc6f7d311f4fbe7b4afba6a7dac0b2bd4d2e6993.jpg",
  "category": "GMV",
  "subcategory": "射击游戏",
  "tags": ["三角洲行动"],
  "parts": 1,
  "isOriginal": true,
  "width": 3840,
  "height": 1634,
  "source": "popular",
  "rank": 1,
  "scrapedAt": "2026-09-28T04:22:36.104Z"
}
```

Search results also carry `keyword` and `rank`; creator uploads carry `userMid`. With comments on, each comment is its own item:

```json
{ "type": "comment", "bvid": "BV1fwh96bEfH", "commentId": "315306945537", "text": "520天", "authorName": "tornado2", "authorMid": 474285588, "likes": 23, "replyCount": 1, "createdAt": "2026-09-27T20:14:17.000Z" }
```

Inputs that cannot be read (a wrong ID, a deleted video) appear as items with an `error` field and are not charged.

### Pricing

You pay per result. Failed inputs are free.

| Apify plan | Per 1,000 videos | Per 1,000 comments |
|---|---|---|
| Free | $10.00 | $4.00 |
| Starter | $10.00 | $4.00 |
| Scale | $10.00 | $4.00 |
| Business | $10.00 | $3.20 |
| Enterprise | $10.00 | $3.20 |

Set a maximum cost per run in the run options and the scraper stops when it is reached.

### FAQ

**Do I need a Bilibili account or cookies?** No. Everything here is public data.

**How many results can I get?** Keyword search is limited by Bilibili to about 1,000 videos per keyword; split broad topics into several keywords. Creator uploads go back to the first video. Popular has about 1,000 entries; Ranking has 100.

**Why are coins or shares empty on some rows?** They come from each video's detail page. Keep **Full stats for every video** on (the default) to get them for every row.

**Are the numbers live?** Yes, every run reads the current counts.

**Can I schedule it?** Yes. Use Apify schedules to track keywords, creators or the Ranking daily, and send results to Google Sheets, a webhook or your database.

### Legal

This scraper collects publicly available data only. You are responsible for how you use it, including compliance with Bilibili's terms and data-protection laws such as GDPR and China's PIPL, especially for personal data in comments.

# Actor input Schema

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

Keywords to search Bilibili videos for, in Chinese or any language (e.g. 原神, 人工智能, minecraft). Each keyword returns up to 'Max videos per source'.

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

Creator user IDs (UID, e.g. 546195) or space URLs (https://space.bilibili.com/546195). Returns their uploads, newest first.

## `chart` (type: `string`):

Also scrape the site-wide 'Popular now' feed (up to about 1,000 videos) or the daily 'Ranking' top 100.

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

Single videos: bilibili.com/video/... URLs, BV ids (BV1...), av ids or b23.tv short links.

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

Maximum videos per keyword, per creator and for Popular/Ranking. Search is capped by Bilibili at about 1,000 results per keyword.

## `sortOrder` (type: `string`):

How keyword search results are ordered.

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

Fetch each video's detail: coins, shares, tags and the creator's follower count. Turn off for faster list-only data (some fields will be empty).

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

Also return comments for each video as separate items (type 'comment'), charged per comment.

## `maxComments` (type: `integer`):

Upper limit of comments per video when comments are on.

## `commentSort` (type: `string`):

Hot (most liked first) or newest first.

## `includeSubReplies` (type: `boolean`):

Also return the replies Bilibili shows under each comment (counted toward the comment limit).

## Actor input object example

```json
{
  "searchKeywords": [
    "原神"
  ],
  "userIds": [],
  "chart": "none",
  "videoUrls": [],
  "maxResults": 10,
  "sortOrder": "totalrank",
  "includeDetails": true,
  "includeComments": false,
  "maxComments": 20,
  "commentSort": "hot",
  "includeSubReplies": false
}
```

# Actor output Schema

## `videos` (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 = {
    "searchKeywords": [
        "原神"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("unbrowseai/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": ["原神"],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("unbrowseai/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": [
    "原神"
  ],
  "maxResults": 10
}' |
apify call unbrowseai/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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