# Bilibili Scraper: 哔哩哔哩 Videos & Comments (`tortuga/bilibili-scraper`) Actor

Bilibili (哔哩哔哩, B站) videos by keyword, URL, uploader (UP主) or trending list: title, views, likes, coins, danmaku count, tags, duration, parts and uploader followers, plus comments with replies and uploader profiles. Chinese text kept as written. No login, no cookies.

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

## Pricing

from $2.72 / 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.
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, Comments & Search

Scrape **Bilibili** (哔哩哔哩, B站), China's largest video platform: search videos by keyword, get full video details, list an uploader's (UP主) videos, read the trending lists, and download comments with their replies. 无需登录，支持关键词搜索、视频详情、UP主投稿、热门榜单和评论（含楼中楼回复）。

Every video row has the title, description, cover, duration, publish date, uploader and Bilibili's public counters: views (播放), likes (点赞), coins (投币), favorites (收藏), shares (分享), danmaku (弹幕) and comments (评论). With full details you also get coins and shares for every source, tags, parts (分P), honours such as "全站排行榜最高第2名", co-creators and the uploader's follower count. Chinese titles, descriptions and comments are kept exactly as written; all field names are in English.

No login, no cookies to paste and no browser. The Actor reads the same public JSON that bilibili.com loads for any visitor.

### What data does Bilibili Scraper extract?

**Videos** (`type: "video"`)

| Field | Description |
|---|---|
| `bvid`, `aid`, `url` | Video IDs (BV and av) and the video URL |
| `title`, `description`, `coverUrl` | Title, description (简介) and cover image |
| `durationSeconds`, `duration` | Length in seconds and as `h:mm:ss` |
| `publishedAt`, `publishedTimestamp` | Publish time (UTC, ISO 8601) and Unix timestamp |
| `uploaderName`, `uploaderMid`, `uploaderUrl`, `uploaderAvatarUrl` | Uploader (UP主) name, UID, space URL and avatar |
| `viewCount`, `likeCount`, `coinCount`, `favoriteCount`, `shareCount`, `danmakuCount`, `commentCount` | Public counters (search rows have no coins and shares; add **Full video details** for them) |
| `category`, `categoryId` | Category name (search and trending lists) and category ID |
| `tags` | Video tags (search rows and detailed videos) |
| `partCount`, `parts` | Number of parts (分P) and, with details, each part's title, duration and URL |
| `honors`, `highestRank` | Honours (每周必看, 热门收录, 全站排行榜最高第N名) and the best all-site rank (details) |
| `uploaderFollowerCount`, `uploaderVideoCount`, `uploaderTotalLikes`, `uploaderVerification` | Uploader stats (details) |
| `coCreators` | Joint uploads: each co-creator's name, UID and role (details) |
| `isOriginal`, `width`, `height`, `publishLocation`, `recommendReason`, `shortUrl` | Original vs repost, resolution, publish location and trending reason (trending lists) |
| `source`, `sourceInput`, `position` | Where the row came from (search term, uploader, list or URL) and its rank there |
| `detailsIncluded`, `detailError` | Whether full details were added (and why not, if a detail request failed) |

**Comments and replies** (`type: "comment"`)

| Field | Description |
|---|---|
| `commentId`, `isReply`, `parentCommentId`, `replyToCommentId` | Comment ID; for replies (楼中楼) the comment they belong to |
| `text`, `imageUrls` | Comment text (emoji codes such as `[doge]` kept) and attached images |
| `likeCount`, `replyCount` | Likes and number of replies |
| `publishedAt`, `publishedTimestamp` | Exact posting time (UTC) |
| `authorName`, `authorMid`, `authorUrl`, `authorAvatarUrl`, `authorLevel`, `authorVipLabel` | Public profile of the commenter |
| `isPinned`, `isByUploader` | Pinned comment (置顶) and comment written by the video's uploader |
| `videoBvid`, `videoAid`, `videoUrl`, `videoTitle`, `position` | The video it belongs to and its position in the comment list |

**Uploaders** (`type: "uploader"`, one per uploader URL): `mid`, `url`, `name`, `avatarUrl`, `sign` (bio), `level`, `followerCount`, `followingCount`, `videoCount`, `totalLikes`, `officialVerification`, `vipLabel`.

Every row also has `scrapedAt`, and in monitoring mode `changeType`.

### How to scrape Bilibili videos

1. **Search terms**: type keywords such as `原神`, `美食` or `python`, one per line. Pick a sort (best match, most views, newest, most danmaku, most favorites, most comments) and a video length if you like.
2. **Bilibili URLs**: paste video URLs (`https://www.bilibili.com/video/BV1p7411Y7BC/`), uploader pages (`https://space.bilibili.com/546195` or just the UID), search URLs or popular-list pages.
3. **Popular / trending lists**: tick Popular now (综合热门), Top 100 ranking (排行榜), Weekly picks (每周必看) or All-time must-watch (入站必刷).
4. Set **Max videos per search / uploader / list** and **Max results (total)**, then click **Start**. Download the dataset as JSON, CSV or Excel, or read it through the API.

### Input example

```json
{
  "searchQueries": ["原神", "美食"],
  "searchOrder": "click",
  "urls": [
    "https://www.bilibili.com/video/BV1p7411Y7BC/",
    "https://space.bilibili.com/546195"
  ],
  "popularLists": ["ranking"],
  "maxResultsPerSource": 50,
  "includeVideoDetails": true,
  "maxCommentsPerVideo": 20,
  "maxRepliesPerComment": 3,
  "maxItems": 2000,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

### Output example

```json
{
  "type": "video",
  "bvid": "BV1p7411Y7BC",
  "aid": 84887919,
  "url": "https://www.bilibili.com/video/BV1p7411Y7BC/",
  "title": "最强自夸王！！！！！",
  "description": "歌曲：《自夸小队》\n作词/演唱：某幻君，老番茄，中国boy超级大猩猩，花少北 ...",
  "coverUrl": "https://i2.hdslb.com/bfs/archive/202bc40ecf4991d21df91f52a2d112eddb977de1.jpg",
  "durationSeconds": 231,
  "duration": "3:51",
  "publishedAt": "2020-01-25T04:00:12Z",
  "uploaderName": "某幻君",
  "uploaderMid": 1577804,
  "uploaderUrl": "https://space.bilibili.com/1577804",
  "viewCount": 41535918,
  "likeCount": 1971620,
  "coinCount": 1797906,
  "favoriteCount": 910129,
  "shareCount": 250215,
  "danmakuCount": 461959,
  "commentCount": 61849,
  "partCount": 1,
  "isOriginal": true,
  "tags": ["自夸小队", "老番茄", "某幻君", "花少北", "RAP"],
  "parts": [{ "page": 1, "cid": 145214418, "title": "自夸小队定稿mv", "durationSeconds": 231, "url": "https://www.bilibili.com/video/BV1p7411Y7BC/?p=1" }],
  "honors": ["第45期每周必看", "全站排行榜最高第2名", "热门", "热门收录"],
  "highestRank": 2,
  "uploaderFollowerCount": 9021493,
  "uploaderVideoCount": 506,
  "uploaderVerification": "2025百大UP主、2025年度原创音乐奖UP主、知名UP主",
  "coCreators": [{ "name": "老番茄", "mid": 546195, "role": "演唱" }],
  "source": "url",
  "sourceInput": "https://www.bilibili.com/video/BV1p7411Y7BC/",
  "position": 1,
  "detailsIncluded": true,
  "scrapedAt": "2026-11-05T15:06:56Z"
}
```

### How to scrape Bilibili comments and replies

Set **Comments per video** to the number of top-level comments you want for every video in the run (video URLs and all videos found by search, uploader or lists). Choose **Hot** (Bilibili's default order, which starts with the uploader's pinned comment) or **Newest**. Set **Replies per comment** to also save replies (楼中楼): each reply follows its comment with `isReply: true` and `parentCommentId`. The first 2-3 replies come with the comment page; longer threads are read 20 replies per request. **Only comments newer than** (`2026-11-01`, `7 days`) keeps recent comments and stops paging when a whole page is older.

### How to scrape an uploader's (UP主) videos

Paste the uploader's space URL (`https://space.bilibili.com/<UID>`) or the UID. You get one uploader row (followers, following, videos, total likes, bio, verification; switch off **Uploader profile row** to skip it) and the uploader's videos newest first, most played or most favorited, each with views, likes, coins, favorites, shares, danmaku and comments.

### Monitor changes on a schedule

Turn on **Only new or changed items** to get only what is new since the last run of the same input: new videos from your searches, uploaders and trending lists, new comments and replies, and uploader rows whose video count changed. The Actor remembers the IDs it already returned (in a key-value store on your account), so unchanged items are not output and not charged, and no detail requests are made for them. Save the input as a task and add a Schedule in Apify (for example daily). Each output row then has `changeType` (`"new"` or `"changed"`) and, for changed uploader rows, `previousValues` with the old video count. Give each watch its own **Monitoring key** if several schedules use the same input.

### Does it work without login or cookies?

Yes. You do not need a Bilibili account and do not paste any cookies. Bilibili hands every anonymous visitor a device ID (buvid3) and asks its web app to sign API requests ("wbi"); the Actor does the same, the way the website does it in your browser. Videos that are deleted, private, region-locked or under review answer "not found" and are skipped without charge (they are listed in the run summary). Paid courses (课堂) in search results and anime/film episodes (番剧) are not covered.

### How many videos can I get?

Bilibili shows at most 50 search pages (about 1,000 videos) per keyword and sort; use several keywords, sorts or length filters for more. Uploader lists go back to the first upload. Popular now has a few hundred videos, the Top 100 ranking 100, the weekly picks about 50 and the all-time list about 100. A video that appears in several sources of the same run is saved once (the first time it is found).

### Proxy note

The default Apify Proxy (datacenter) works for Bilibili's API. The Actor behaves like a few ordinary visitors: each one keeps its own IP and the anonymous device ID Bilibili gave it. If Bilibili's risk control refuses a request (HTTP 412 "request was banned" or code -352), that visitor is replaced by a new one on a new IP, and from the third attempt the request goes through Apify residential proxy (a few KB of JSON). In our test runs about 1,800 requests needed 7 retries. You do not need to change anything, and the proxy cost is included in the price.

### Pricing

Pay per row, with platform usage included:

- **$0.012** per video row from a search, uploader or trending list, and per uploader profile row
- **$0.015** per video with full details (video URLs, or list videos with **Full video details** on)
- **$0.012** per comment or reply

Skipped and failed items are not charged. **Max results (total)** caps the cost of a run.

### Integrations and API

Run it from the Apify API, Python or JavaScript clients, Zapier, Make, n8n or Google Sheets, and let AI agents call it through Apify's MCP server. Typical uses: trend and topic research in China, KOL (UP主) discovery and benchmarking, brand and game launch monitoring, comment sentiment analysis, and tracking an uploader's new videos on a schedule.

### Is it legal to scrape Bilibili?

The Actor reads only what bilibili.com shows publicly to any visitor without logging in: public videos, their public counters, public uploader profiles and public comments with the commenter's public nickname. It does not log in, does not solve CAPTCHAs and does not access private, paid or members-only content. Comments and profiles belong to real people: if you store or publish them, follow Bilibili's terms and the data protection law that applies to you (for example GDPR or China's PIPL), and use the data for a legitimate purpose.

### Support

A video, uploader or list that fails, or a field you need? Open an issue in the **Issues** tab with the URL. Issues are usually answered within a day.

### Related scrapers

- [Naver Scraper](https://apify.com/tortuga/naver-scraper): Blog, Cafe & News Posts from Korea
- [TikTok Profile, Video Stats & Comments Scraper](https://apify.com/tortuga/tiktok-scraper)
- [YouTube Scraper](https://apify.com/tortuga/youtube-scraper): Channels, Videos, Shorts & Search
- [Twitch Scraper](https://apify.com/tortuga/twitch-scraper): Channels, Streams, Clips & Top Games
- [TikTok Shop Scraper](https://apify.com/tortuga/tiktok-shop-scraper): Products, Prices & Sales

### Found it useful?

A ★ review on this Actor's Apify Store page helps other users find it and tells us what to improve. Issues and feature requests are welcome in the Actor's **Issues** tab.

# Actor input Schema

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

Keywords to search on Bilibili, one per line, in Chinese or any language (e.g. 原神, 美食, python). Each term returns up to 'Max videos per search / uploader / list' videos, up to 1,000 (Bilibili's own limit of 50 pages).

## `searchOrder` (type: `string`):

Bilibili's search sort: best match (综合排序), most views (最多播放), newest (最新发布), most danmaku (最多弹幕), most favorites (最多收藏) or most comments (最多评论).

## `searchDuration` (type: `string`):

Bilibili's duration filter for search results.

## `urls` (type: `array`):

One per line: video URLs (bilibili.com/video/BV... or av..., always returned with full details), uploader pages (space.bilibili.com/<UID>, or a bare UID number), search URLs (search.bilibili.com/all?keyword=...) and popular-list pages (bilibili.com/v/popular/all, /rank/all, /weekly, /history). b23.tv short links are not supported.

## `includeUploaderInfo` (type: `boolean`):

For each uploader URL, also save one row with the uploader's profile: name, followers, following, number of videos, total likes, level, bio and verification. Charged as one result.

## `uploaderSort` (type: `string`):

Order of an uploader's videos: newest first, most played or most favorited.

## `popularLists` (type: `array`):

Bilibili's own trending lists: Popular now (综合热门, a few hundred videos), Top 100 ranking (排行榜), Weekly picks (每周必看, latest issue) and All-time must-watch (入站必刷). Each list returns up to 'Max videos per search / uploader / list' videos.

## `maxResultsPerSource` (type: `integer`):

Stop each search term, each uploader and each popular list after this many videos. 0 = uploader profile rows only.

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

Also open every video from searches, uploaders and lists for tags, coins, shares, parts (分P), honours, highest rank and the uploader's follower count. Charged as a 'video details' event instead of a list result. Video URLs always get details.

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

Also save up to this many top-level comments for every video in the run (video URLs and all videos found by search, uploader or list). 0 = no comments. Each comment and reply is charged as one 'comment' event.

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

Hot comments first (Bilibili's default, includes the uploader's pinned comment) or newest first.

## `maxRepliesPerComment` (type: `integer`):

Also save up to this many replies under each comment (楼中楼). Up to 2-3 replies come with the comment page itself; more are read from the comment's reply thread, 20 per request. 0 = no replies.

## `commentsNewerThan` (type: `string`):

Only comments and replies newer than: a date (YYYY-MM-DD) or a period such as '7 days' or '24 hours'. Switches comment order to newest first and stops reading a video's comments once a whole page is older.

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

Stop the whole run after this many saved rows (videos, uploader rows, comments and replies together). Every saved row is charged, so this caps the cost.

## `onlyNewOrChanged` (type: `boolean`):

Remember what earlier runs of this input returned and output only new videos and comments, plus uploader rows whose video count changed. Use with a Schedule; unchanged items are not charged.

## `monitoringKey` (type: `string`):

Name for this watch, so several schedules on the same input stay separate; defaults to a key derived from the input

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

Apify Proxy (datacenter) works for Bilibili's API and is the default. When Bilibili's risk control refuses a request twice (HTTP 412), the third and later tries of that request go through Apify RESIDENTIAL automatically (a few KB of JSON each). The proxy cost is included in the result price.

## Actor input object example

```json
{
  "searchQueries": [
    "原神"
  ],
  "searchOrder": "totalrank",
  "searchDuration": "all",
  "urls": [
    "https://www.bilibili.com/video/BV1p7411Y7BC/"
  ],
  "includeUploaderInfo": true,
  "uploaderSort": "pubdate",
  "maxResultsPerSource": 50,
  "includeVideoDetails": false,
  "maxCommentsPerVideo": 0,
  "commentSort": "hot",
  "maxRepliesPerComment": 0,
  "maxItems": 1000,
  "onlyNewOrChanged": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "searchQueries": [
        "原神"
    ],
    "urls": [
        "https://www.bilibili.com/video/BV1p7411Y7BC/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("tortuga/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": ["原神"],
    "urls": ["https://www.bilibili.com/video/BV1p7411Y7BC/"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("tortuga/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": [
    "原神"
  ],
  "urls": [
    "https://www.bilibili.com/video/BV1p7411Y7BC/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call tortuga/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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