# Bilibili Scraper - Videos, Search, Channels, Trending (`teodor_banea/bilibili-scraper`) Actor

Scrape public Bilibili (B站) data: keyword video search with filters, video details with full stats and tags, channel uploads, trending and ranking boards, channel details, user search, hot searches and danmaku. No login, no proxy setup.

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

## Pricing

from $2.00 / 1,000 results

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 — Videos, Search, Channels, Trending & Danmaku

### What does Bilibili Scraper do?

Bilibili Scraper exports public data from Bilibili (B站, bilibili.com) — no login, no Bilibili account, no API key and no proxy setup. Pick one mode per run:

| Mode | You enter | You get |
|---|---|---|
| **Video search** | keywords (Chinese or any language), optional sort, length, category and date filters | one row per video in Bilibili's order, with full stats and tags |
| **Video details** | video links, BV ids, av numbers or b23.tv short links | one row per video: title, description, duration, date, category, all tags, views, danmaku, comments, favourites, coins, shares, likes, parts, collection, honours, co-creators, uploader |
| **Channel videos** | channel links, numbers or exact channel names | every video of each channel, newest first, read to the very end, with full stats; each row names the channel it was listed from (`sourceChannelId`) |
| **Trending and ranking boards** | the boards you want | Popular now (up to 500), Ranking (top 100 of a category), Weekly must-watch (每周必看) and All-time must-watch (入站必刷), each row with its board and rank |
| **Channel details** | channel links, numbers or names | one row per channel: name, followers, following, the number of videos the channel shows, total likes, level, verification |
| **Channel search** | keywords | channels matching each keyword, with the same channel details |
| **Hot searches** | nothing | the current hot search words with their heat score |
| **Danmaku (bullet comments)** | videos | the danmaku of each video and part: text, the moment in the video, sent time, display mode and colour |

Every row is flat, has the same keys for its type (missing values are `null`, never left out), uses ISO 8601 UTC dates, integer counters and absolute https URLs. Chinese text is kept exactly as published.

### Why use this Actor?

- **Eight modes in one Actor** — search, video details, channel uploads, four trending boards, channel details, channel search, hot searches and danmaku.
- **Full stats on every video** — views, danmaku, comments, favourites, coins, shares and likes, plus all tags, parts, collection and honours (turn off "Include full video details" for faster, lighter runs).
- **Complete channel listings** — channel uploads are paged to the last video and checked against the count the channel shows.
- **Search filters that work** — sort by views, newest, danmaku, favourites or comments; length bands; main category; date window.
- **Robust** — Bilibili's temporary blocks are retried automatically; one deleted or hidden video never fails the run, it is listed under ERRORS.
- **Privacy-minded** — channel rows never include sex, birthday or location; the channel sign line is only kept for verified accounts; danmaku rows carry no sender identifier.

### How much does it cost?

The Actor is priced per result: **$2.00 per 1,000 rows** plus **$0.005 per run start**. Platform usage is included.

| Example run | Rows | Price |
|---|---|---|
| 20 search results with full details (the prefilled input) | 20 | $0.045 |
| 500 search results for one keyword, with full details | 500 | $1.005 |
| 300 newest videos of a channel | 300 | $0.605 |
| Popular now + Ranking + both must-watch lists | ~750 | ~$1.505 |
| 50 hot search words | 50 | $0.105 |

Videos, channels or queries that do not exist or have no results produce no rows and cost nothing beyond the start fee.

### Input

| Field | Description | Example |
|---|---|---|
| `mode` | `search`, `videoDetails`, `channelVideos`, `trending`, `channelDetails`, `userSearch`, `hotSearches` or `danmaku`. | `"search"` |
| `searchQueries` | Keywords for Video search and Channel search. | `["原神", "咖啡"]` |
| `sortBy` | `relevance`, `views`, `newest`, `danmaku`, `favorites` or `comments`. | `"views"` |
| `durationFilter` | `any`, `under10`, `from10to30`, `from30to60`, `over60` (minutes). | `"under10"` |
| `category` | Main category filter for search (`gaming`, `music`, `knowledge`, `tech`, …). | `"gaming"` |
| `maxVideosPerQuery` | Videos per search query (0 = as many as Bilibili shows, about 1,000). | `100` |
| `videoUrls` | Videos for Video details and Danmaku: links, BV ids, av numbers, b23.tv short links. | `["BV17x411w7KC", "av170001"]` |
| `maxDanmakuPerVideo` | Danmaku per video across its parts (default 100; 0 = all Bilibili shows). Every danmaku line is one billed row, and a long multi-part video can have 10,000 or more. | `100` |
| `channels` | Channels: `https://space.bilibili.com/546195`, `546195`, or the exact channel name. | `["https://space.bilibili.com/2"]` |
| `maxVideosPerChannel` | Videos per channel, newest first (0 = all). | `100` |
| `postedAfter` / `postedBefore` | Date window (UTC) for Video search and Channel videos — a date or a period such as `"7 days"`. | `"7 days"` |
| `trendingBoards` | Any of `popular`, `ranking`, `weekly`, `mustWatch`. | `["popular", "ranking"]` |
| `rankingCategory`, `rankingType` | Category of the Ranking board; `all`, `original` or `newcomers`. | `"gaming"`, `"all"` |
| `weeklyIssue` | Weekly must-watch issue number (empty = latest). | `399` |
| `includeVideoDetails` | Full stats, tags and extras for every video (on by default). | `true` |
| `maxUsersPerQuery`, `includeChannelDetails` | Channel search: channels per keyword; read each channel's card (on by default). | `50`, `true` |
| `maxResults` | Rows per run (0 = unlimited, capped at 10,000). | `100` |

### Output

One dataset per run; the row type follows the mode. Example rows (fictitious):

```json
{
    "rowType": "video",
    "bvid": "BV1Ab4y1C7dE",
    "aid": 115000000000001,
    "url": "https://www.bilibili.com/video/BV1Ab4y1C7dE",
    "title": "示例视频：手冲咖啡入门",
    "description": "这是一个示例视频简介。",
    "durationSec": 412,
    "publishedAt": "2026-11-12T08:30:00Z",
    "category": "美食制作",
    "categoryId": 76,
    "tags": ["咖啡", "教程"],
    "viewsCount": 125000,
    "danmakuCount": 860,
    "commentsCount": 412,
    "favoritesCount": 5300,
    "coinsCount": 2100,
    "sharesCount": 340,
    "likesCount": 9800,
    "ownerId": 100000001,
    "ownerName": "示例频道 Example Channel",
    "ownerUrl": "https://space.bilibili.com/100000001",
    "coverUrl": "https://i0.hdslb.com/bfs/archive/example.jpg",
    "partsCount": 1,
    "isOriginal": true,
    "isChargeOnly": false,
    "pubLocation": null,
    "honors": ["全站排行榜最高第40名"],
    "collectionTitle": "示例合集",
    "coAuthors": [],
    "hasFullDetails": true,
    "searchQuery": "咖啡",
    "searchPosition": 1,
    "board": null,
    "rank": null,
    "boardNote": null,
    "sourceInput": null,
    "sourceChannelId": null,
    "scrapedAt": "2026-11-19T10:00:00.000Z"
}
```

```json
{
    "rowType": "channel",
    "channelId": 100000001,
    "name": "示例频道 Example Channel",
    "url": "https://space.bilibili.com/100000001",
    "followersCount": 250000,
    "followingCount": 120,
    "videosCount": 350,
    "likesCount": 4100000,
    "level": 6,
    "isVerified": true,
    "verifiedType": "organization",
    "verifiedReason": "示例机构官方账号",
    "avatarUrl": "https://i0.hdslb.com/bfs/face/example.jpg",
    "description": "示例机构的官方频道",
    "isLive": null,
    "hasFullDetails": true,
    "searchQuery": null,
    "searchPosition": null,
    "sourceInput": "https://space.bilibili.com/100000001",
    "scrapedAt": "2026-11-19T10:00:00.000Z"
}
```

```json
{ "rowType": "hotSearch", "rank": 1, "keyword": "示例热搜词", "displayName": "示例热搜词", "heatScore": 3057945, "searchUrl": "https://search.bilibili.com/all?keyword=%E7%A4%BA%E4%BE%8B", "scrapedAt": "2026-11-19T10:00:00.000Z" }
```

```json
{ "rowType": "danmaku", "danmakuId": "2245151313816830976", "bvid": "BV1Ab4y1C7dE", "videoUrl": "https://www.bilibili.com/video/BV1Ab4y1C7dE", "partNumber": 1, "partTitle": null, "text": "前排！", "videoTimeSec": 122.885, "sentAt": "2026-11-12T09:15:00Z", "displayMode": "scroll", "fontSize": 25, "color": "#ffffff", "sourceInput": "BV1Ab4y1C7dE", "scrapedAt": "2026-11-19T10:00:00.000Z" }
```

Videos, channels and queries that could not be read are listed in the run's key-value store under **ERRORS**, each with the input you gave and a plain reason (not found, not visible, no results).

### Tips and tricks

- **Search shows about 1,000 videos per keyword.** That is Bilibili's own limit. To go further, split the work: several more specific keywords, a sort order, length bands, a category, or a date window per run.
- **Complete vs. sample.** Channel videos give a complete listing of a channel (the run log compares it with the count the channel shows; videos hidden from logged-out visitors are missing). Search, Popular now and the boards are discovery surfaces — a ranked sample, not an archive.
- **Faster, lighter runs:** turn off "Include full video details". Search rows then keep views, danmaku, comments, favourites, likes and tags but not coins, shares, parts or honours; channel rows keep full stats but not tags.
- **Danmaku:** every danmaku line is one billed row. The default is 100 per video; a long multi-part video can have 10,000 or more, so raise the limit deliberately. Logged-out visitors see up to about 1,000-1,200 of the most recent danmaku per part; multi-part videos are read part by part.
- **Comments are not included:** Bilibili shows comments to logged-out visitors only partly (a few per video), so this Actor does not offer them.
- **Category names** are Bilibili's Chinese names; `categoryId` is the numeric id. A few newer category ids have no name yet (category is then null).
- **Original vs. re-upload:** `isOriginal` is often null — Bilibili does not state it clearly to logged-out visitors, and the Actor never guesses.
- **Channel video counts:** `videosCount` is the number of videos the channel shows on its page (articles, audio and other uploads are not counted); null when Bilibili does not give it.
- **Co-created videos:** in Channel videos, a joint video can belong to another uploader (`ownerId`); `sourceChannelId` is the channel you asked for.
- **Maximum charge per run:** when the limit you set in Run options is reached, the run stops cleanly, keeps the rows delivered and says so in its status.
- **Duplicates:** two entries that name the same video or channel (an av number and its BV id, a name and its number) are read once; the final status says how many.
- **BV ids are case-sensitive:** copy them exactly; an all-lower-case id is listed under ERRORS instead of being read as a different video.

### Scheduling

The Actor keeps no memory between runs. For a daily or weekly feed, schedule it with **Posted after** set to the schedule interval (for example `"1 day"` for a daily run, or a bit more to overlap) in Video search or Channel videos, and de-duplicate downstream by `bvid`. Trending boards and hot searches are snapshots: schedule them as often as you want a new snapshot.

### Integrations

Results are a standard Apify dataset: download JSON, CSV or Excel from the run page, read them with the Apify API, or send them to Google Sheets, Zapier, Make, Slack or a webhook with Apify integrations.

# Changelog

This Actor's version history is a separate document: https://apify.com/teodor_banea/bilibili-scraper/changelog.md

# Actor input Schema

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

Choose what the run collects. Video search: videos matching your keywords. Video details: the videos you link. Channel videos: the uploads of channels. Trending: popular, ranking and must-watch boards. Channel details: one row per channel. Channel search: channels matching your keywords. Hot searches: the current hot search words. Danmaku: the bullet comments of videos.

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

Enter keywords, one per line (Chinese or any language). Used by "Video search" and "Channel search". Bilibili shows at most about 1,000 videos per query; use the filters or more specific keywords to go further.

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

Choose the order of the search results.

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

Keep only videos of this length.

## `category` (type: `string`):

Keep only videos of this main category.

## `maxVideosPerQuery` (type: `integer`):

Limit the videos taken from each search query. Set to 0 for as many as Bilibili shows (about 1,000).

## `maxUsersPerQuery` (type: `integer`):

Limit the channels taken from each query in "Channel search". Set to 0 for as many as Bilibili shows (about 1,000).

## `includeChannelDetails` (type: `boolean`):

In "Channel search", also read each channel's card and its video count: following and likes counts, the verified reason and the number of videos the channel shows. Adds two small requests per channel.

## `channels` (type: `array`):

Enter channels, one per line: a channel link (https://space.bilibili.com/546195), the channel number (546195) or the exact channel name. Used by "Channel videos" and "Channel details".

## `maxVideosPerChannel` (type: `integer`):

Limit the videos taken from each channel (newest first). Set to 0 for all.

## `postedAfter` (type: `string`):

Keep only videos published on or after this date (UTC), or within a recent period such as "7 days". Applies to "Video search" and "Channel videos". Useful for scheduled runs.

## `postedBefore` (type: `string`):

Keep only videos published before this date (UTC). Applies to "Video search" and "Channel videos".

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

Enter videos, one per line: a link (https://www.bilibili.com/video/BV1xx411c7mD), a BV id, an av number (av170001) or a b23.tv short link. Used by "Video details" and "Danmaku". Up to 5,000 per run.

## `maxDanmakuPerVideo` (type: `integer`):

Limit the danmaku (bullet comments) taken from each video, across all its parts. Cost note: every danmaku line is one billed row, and a long multi-part video can have 10,000 or more. Bilibili shows logged-out visitors up to about 1,000-1,200 of the most recent danmaku per part. Set to 0 for all it shows.

## `trendingBoards` (type: `array`):

Choose the boards to read. Popular now: up to 500 videos trending today. Ranking: the top 100 of a category. Weekly must-watch: the 每周必看 list. All-time must-watch: the 入站必刷 list.

## `rankingCategory` (type: `string`):

Choose the category of the Ranking board (up to 100 videos).

## `rankingType` (type: `string`):

Choose which ranking to read.

## `weeklyIssue` (type: `integer`):

Enter an issue number of the weekly must-watch list (e.g. 399). Leave empty or 0 for the latest issue.

## `includeVideoDetails` (type: `boolean`):

Read each video's own page data too: exact views, danmaku, comments, favourites, coins, shares and likes, all tags, parts, collection, honours and co-creators. Adds one or two requests per video, so runs take longer. Applies to "Video search", "Channel videos" and "Trending" ("Video details" always includes them).

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

Limit the rows of the whole run (videos, channels, hot searches or danmaku). Set to 0 for unlimited (capped at 10,000 to protect you from a surprise bill).

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "原神",
    "咖啡",
    "travel vlog"
  ],
  "sortBy": "relevance",
  "durationFilter": "any",
  "category": "all",
  "maxVideosPerQuery": 100,
  "maxUsersPerQuery": 50,
  "includeChannelDetails": true,
  "channels": [
    "https://space.bilibili.com/546195",
    "2"
  ],
  "maxVideosPerChannel": 100,
  "videoUrls": [
    "https://www.bilibili.com/video/BV17x411w7KC",
    "BV1Q541167Qg",
    "av170001"
  ],
  "maxDanmakuPerVideo": 100,
  "trendingBoards": [
    "popular"
  ],
  "rankingCategory": "all",
  "rankingType": "all",
  "weeklyIssue": 399,
  "includeVideoDetails": true,
  "maxResults": 20
}
```

# Actor output Schema

## `results` (type: `string`):

Every row of the run as JSON.

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

Video rows.

## `channels` (type: `string`):

Channel rows.

## `resultsCsv` (type: `string`):

The same rows as a CSV download.

## `errors` (type: `string`):

Inputs that could not be read and why. Only present when something went wrong.

# 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": [
        "原神"
    ],
    "maxResults": 20
};

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

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

```

## MCP server setup

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