# Bilibili Scraper - Videos, Comments, Danmaku & Uploaders (`v1tal615/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩) videos by keyword, URL, uploader or trending list. Get views, likes, coins, favorites, tags, uploader stats, comments and danmaku as JSON, CSV or Excel. Fast HTTP scraper, no browser.

- **URL**: https://apify.com/v1tal615/bilibili-scraper.md
- **Developed by:** [bình minh trần](https://apify.com/v1tal615) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $12.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.

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, comments, danmaku and uploaders (B站 / 哔哩哔哩)

Scrape **Bilibili** (bilibili.com, B站) without an API key. Search videos by keyword, pull full stats for any video URL, export every video of an uploader (UP主), grab the trending lists, and add **comments** and **danmaku (弹幕 bullet comments)**. Export to JSON, CSV, Excel, or call it from your code, n8n, Make, Zapier or an AI agent (MCP).

It talks directly to Bilibili's own JSON endpoints with HTTP requests (no browser), so runs are fast and cheap. It handles Bilibili's guest cookies, WBI request signing and risk-control retries for you.

### What you can scrape

| Source | Input | You get |
| --- | --- | --- |
| 🔎 **Keyword search** | `原神`, `minecraft`, `AI` ... | Videos ranked by relevance, views, newest, danmaku or favorites. Filter by publish date and length. |
| 🎬 **Video URLs** | `bilibili.com/video/BV...`, `b23.tv/...`, BV or av ids | Full stats: views, likes, **coins**, favorites, shares, danmaku and comment counts, tags, original or repost, parts. |
| 👤 **Uploaders (UP主)** | `space.bilibili.com/946974`, UID or exact name | Profile (followers, total likes, video count, level, verification) **plus all their videos, newest first**. |
| 🔥 **Trending** | `Popular now (综合热门)` or `Must-watch (入站必刷)` | The current trending feed with full stats. |
| 💬 **Comments** | toggle on | Comment text, likes, reply count, time, author name and level, with reply threads. |
| 📺 **Danmaku** | toggle on | Bullet comments with the exact second in the video, text, mode, color and send time. |

### Why this scraper

- **About 40% cheaper** than the most-used Bilibili scraper on the Store: pay only for the records you get, no monthly rental.
- **Complete video stats**: coins, shares and tags are included when you turn on *Fetch full video details* (always on for video URLs).
- **Full uploader history**: lists every upload of a channel, not just the first page.
- **Danmaku timeline**: see which second of a video triggers reactions.
- **Built to keep working**: automatic session refresh and backoff when Bilibili rate-limits, checked daily by an automated health test.
- **Privacy-minded**: no avatars, gender, birthdays, IP-location strings or danmaku sender hashes are collected.

### How to use it

1. Click **Try for free**.
2. Fill in at least one source: search keywords, video URLs, uploaders or a trending list.
3. Optionally turn on *Fetch full video details*, *Include comments* or *Include danmaku*.
4. Click **Start** and download the results from the **Output** tab (Videos, Uploaders, Comments and Danmaku views).

#### Input example

```json
{
    "searchQueries": ["原神", "minecraft"],
    "uploaders": ["https://space.bilibili.com/946974"],
    "trending": "popular",
    "maxResults": 100,
    "searchSortBy": "views",
    "publishedAfter": "30 days",
    "fetchFullDetails": true,
    "includeComments": true,
    "maxCommentsPerVideo": 50,
    "includeDanmaku": false
}
```

### Output

Every record has a `type` field: `video`, `uploader`, `comment` or `danmaku`.

#### Video

```json
{
    "type": "video",
    "bvid": "BV1Mh411m7sA",
    "aid": 205295224,
    "cid": 331193425,
    "url": "https://www.bilibili.com/video/BV1Mh411m7sA",
    "title": "床",
    "description": "希望观众老爷喜欢这个系列！
（希望你们喜欢，记得素质三连！）",
    "coverUrl": "https://i2.hdslb.com/bfs/archive/09288341facb55813ab9db598127a90290984200.jpg",
    "durationSec": 735,
    "publishedAt": "2021-04-30T04:19:31Z",
    "category": "单机游戏",
    "tags": ["MC", "我的世界", "MINECRAFT", "单机游戏", "小潮", "搞笑"],
    "views": 27083295,
    "likes": 633000,
    "coins": 158089,
    "favorites": 132050,
    "shares": 14337,
    "danmakuCount": 116564,
    "commentCount": 5013,
    "isOriginal": true,
    "partsCount": 1,
    "uploaderMid": 5970160,
    "uploaderName": "小潮院长",
    "uploaderUrl": "https://space.bilibili.com/5970160",
    "uploaderFollowers": 15637522,
    "source": "search",
    "searchQuery": "minecraft",
    "position": 1,
    "detailLevel": "full",
    "scrapedAt": "2026-10-03T11:01:27Z"
}
```

`detailLevel` tells you how complete the stats are: `full` (all fields), `listing` (trending lists, no tags) or `basic` (search and uploader lists without *Fetch full video details*: no coins, shares or follower count). `category` comes from search and trending lists; Bilibili no longer returns it for videos found through an uploader or a direct URL, so it is `null` there.

#### Uploader

```json
{
    "type": "uploader",
    "mid": 946974,
    "url": "https://space.bilibili.com/946974",
    "name": "影视飓风",
    "bio": "无限进步！...",
    "followers": 18531116,
    "following": 686,
    "videoCount": 947,
    "articleCount": 0,
    "totalLikes": 128163426,
    "level": 6,
    "verifiedTitle": "2025百大UP主、2023年度最高人气奖UP主、课堂优质讲师",
    "scrapedAt": "2026-10-03T10:52:11Z"
}
```

#### Comment

```json
{
    "type": "comment",
    "videoBvid": "BV14JHq66E3p",
    "videoAid": 117377396115743,
    "commentId": 319499068928,
    "rootId": 315919146657,
    "parentId": 315919146657,
    "isReply": true,
    "text": "这套真是 太美了",
    "likes": 0,
    "replyCount": 0,
    "postedAt": "2026-10-03T14:37:47Z",
    "authorName": "咸鱼捞月月月月eve",
    "authorMid": 22425123,
    "authorLevel": 6,
    "scrapedAt": "2026-10-03T10:52:34Z"
}
```

#### Danmaku

```json
{
    "type": "danmaku",
    "videoBvid": "BV14JHq66E3p",
    "cid": 42431218197,
    "timeSec": 0.792,
    "text": "啊啊啊啊啊啊",
    "mode": "scroll",
    "fontSize": 25,
    "color": "#ffffff",
    "sentAt": "2026-10-03T14:46:57Z",
    "scrapedAt": "2026-10-03T10:52:35Z"
}
```

### Pricing

Pay per result, no subscription. You are only charged for records that land in your dataset.

| Record | Price |
| --- | --- |
| Video | $12.00 per 1,000 |
| Uploader profile | $12.00 per 1,000 |
| Comment or reply | $12.00 per 1,000 |
| Danmaku line | $2.00 per 1,000 |

The exact current prices are always shown on the **Pricing** tab. Set *Maximum cost per run* in the run options and the scraper stops cleanly when it is reached.

### FAQ

**Why do I only get a few comments per video?**
Bilibili shows guests (logged-out visitors) only the top few comments of each video, plus the replies under them. To get the full comment list, paste the `SESSDATA` cookie of your own Bilibili account into the *SESSDATA cookie* field. It is stored encrypted and only sent to bilibili.com. A free Bilibili account is enough.

**Can I get more than 1,000 search results for a keyword?**
Bilibili itself stops search at 1,000 results (50 pages). Split the period with *Published after* / *Published before*, or use several related keywords.

**How many danmaku can I get?**
Bilibili serves the current danmaku pool of each video, usually up to a few thousand lines depending on video length.

**Do I need a proxy?**
Usually not. Bilibili limits how much one IP can fetch in a short time (roughly a few hundred requests). The scraper paces itself, pauses everyone together when Bilibili pushes back, and if the direct IP gets hard-blocked it automatically continues through Apify Proxy. If Bilibili still blocks for more than 5 minutes, the run stops early and keeps everything it already scraped, so you never pay for a stuck run. For very large jobs (thousands of videos with full details, comments and danmaku), enable Apify Proxy in the *Advanced* section from the start, or split the job into several runs.

**Is scraping Bilibili legal?**
This Actor only collects publicly visible data and leaves out personal details such as avatars, gender, birthdays and location. You are responsible for how you use the data; check Bilibili's terms and the data protection laws that apply to you (GDPR, PIPL...), especially for comment author names.

**Can I use it from code or an AI agent?**
Yes. Use the Apify API (Python and JavaScript clients), the integrations (Make, Zapier, n8n, Google Sheets, webhooks), or call it as a tool through the Apify MCP server.

### Feedback

Found a bug or need another Bilibili field? Open an issue on the **Issues** tab, it is usually fixed within a few days.

# Actor input Schema

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

Keywords to search on Bilibili, in Chinese or English (e.g. 原神, minecraft, AI). Each keyword returns up to 'Max results' videos (Bilibili caps search at 1,000 per keyword, use date filters to go further).

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

Bilibili video links (bilibili.com/video/BV..., m.bilibili.com, b23.tv short links), BV ids or av ids. Returns full details for each video.

## `uploaders` (type: `array`):

Uploader space URLs (space.bilibili.com/946974), numeric UIDs, or exact display names. Returns the uploader profile and, optionally, their videos (newest first).

## `trending` (type: `string`):

Also scrape a Bilibili trending list. 'Popular' is the live 综合热门 feed; 'Weekly must-watch' is 入站必刷.

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

Upper limit of videos returned for each search keyword, each uploader and the trending list.

## `searchSortBy` (type: `string`):

Ordering used for keyword search.

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

Only videos published on or after this date (Beijing time). Absolute date or relative like '30 days'. Search only.

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

Only videos published on or before this date (Beijing time). Search only.

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

Filter search results by duration.

## `fetchFullDetails` (type: `boolean`):

For search, uploader and trending results, open every video to add coins, shares, tags, original/repost flag and uploader follower count. Slower (one extra request per video). Video URLs always get full details.

## `scrapeUploaderVideos` (type: `boolean`):

For each uploader, also return their videos (newest first, up to 'Max results'). Turn off to get profiles only.

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

Also scrape comments of every video found. Without a SESSDATA cookie Bilibili only shows the top few comments (and their replies) to guests.

## `maxCommentsPerVideo` (type: `integer`):

Limit of comments + replies per video.

## `commentSortBy` (type: `string`):

Hot (most liked) or newest first. Newest needs a SESSDATA cookie to go beyond the first page.

## `includeReplies` (type: `boolean`):

Also fetch the reply threads under each top-level comment.

## `includeDanmaku` (type: `boolean`):

Also scrape the danmaku shown over each video: text, second in the video, mode, color and send time.

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

Limit of danmaku lines per video (Bilibili serves the current pool, usually up to a few thousand).

## `sessdata` (type: `string`):

Optional. The SESSDATA cookie of your own Bilibili account, only needed for full comment lists. It is stored encrypted and only sent to bilibili.com.

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

Not needed in most cases. Enable if Bilibili keeps rate-limiting your runs.

## Actor input object example

```json
{
  "searchQueries": [
    "原神"
  ],
  "videoUrls": [],
  "uploaders": [],
  "trending": "none",
  "maxResults": 50,
  "searchSortBy": "relevance",
  "durationFilter": "any",
  "fetchFullDetails": false,
  "scrapeUploaderVideos": true,
  "includeComments": false,
  "maxCommentsPerVideo": 100,
  "commentSortBy": "hot",
  "includeReplies": true,
  "includeDanmaku": false,
  "maxDanmakuPerVideo": 1000,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `allResults` (type: `string`):

No description

## `summary` (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 = {
    "searchQueries": [
        "原神"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("v1tal615/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("v1tal615/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 v1tal615/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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