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

Scrape Bilibili (B站) videos with views, likes, coins, favorites and tags, plus danmaku (弹幕) with their time in the video, top comments and replies, and UP主 creator profiles. Search by keyword, video link or UID. No login or cookies. $1.49 per 1,000 videos.

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

## Pricing

from $1.49 / 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

Collect Bilibili (哔哩哔哩, B站) data without an account:

- **Videos:** title, description, cover, publish time, length, category, creator (UP主), views, likes, coins, favorites, shares, comment and danmaku counts, and tags.
- **Danmaku (弹幕):** the bullet comments Bilibili's player loads, each with its time in the video, text, colour, mode and the time it was sent.
- **Top comments (评论):** the top comments and the first 20 replies under each, with likes and dates.
- **Creators (UP主):** followers, video count, likes, level, verification and public collections.

Start from search terms, video links, creator links or UIDs, or paste the text the Bilibili app copies with **Share > Copy link**. No Bilibili account, login or cookies needed.

**$1.49 per 1,000 videos.** Comments $0.49 per 1,000 and danmaku $0.10 per 1,000, only when you turn them on. No start fee. Maintained by CleanScrape.

**中文简介：** 无需登录、无需 Cookie。按关键词、视频链接（BV号、av号、b23.tv 分享链接或 App 复制的分享文字）或 UP主（空间链接、UID）采集哔哩哔哩数据：视频信息及播放、点赞、投币、收藏、分享数据，弹幕（含出现时间），热门评论及回复，UP主资料。可导出 Excel、CSV 或 JSON。时间均为 UTC（北京时间 = UTC+8）。每 1,000 个视频 1.49 美元。

### Why this one is fast without getting blocked

Bilibili limits how fast one visitor can read each kind of data, and it blocks an IP for minutes to an hour when that limit is crossed. We measured those limits field by field. This Actor:

- spreads the work over several connections (proxy IPs) at once, up to 10;
- keeps every connection under the measured pace for each field (details, tags, comments, danmaku, search);
- moves work to the other connections when Bilibili refuses one, and never retries aggressively or tries to get around Bilibili's checks;
- remembers which proxy IPs are refused for which field, so the next run skips them.

Measured in our tests:

| Job | Time |
| --- | --- |
| 100 videos with tags (the default input) | 45 seconds |
| 1,000 videos from 50 search terms | 7 minutes |
| 236 videos from two creators' collections | 75 seconds |
| 1,889 videos with tags, related videos, top comments, replies and danmaku (133,737 rows) | 23 minutes |

On the run's own single connection the same work is several times slower (about 17 videos a minute instead of over 100).

### Quick start

1. Type a search term under **Search terms**, for example `咖啡` (coffee). Chinese terms find more videos than English ones.
2. Choose the extra data under **Data to collect for each video**. Video details and statistics are always included.
3. Start the run. Open **Output** and pick **Videos**, **Comments**, **Danmaku** or **Creators** from the menu: each is its own table.
4. To download, open **Storage > Dataset**, choose the table in the **Dataset** menu, pick CSV, Excel or JSON and select **Download**. The **Export** button at the top downloads the videos.

JSON input example:

```json
{
  "searchQueries": ["咖啡"],
  "maxVideosPerQuery": 100,
  "includeComments": true,
  "includeDanmaku": true,
  "maxDanmakuPerVideo": 500
}
```

Other ways to start:

| You have | Put it in | You get |
| --- | --- | --- |
| Search terms | **Search terms** | Up to 1,000 videos per term, in Bilibili's relevance order |
| Video links, BV ids, av ids, b23.tv links, or the text the app copies with Share > Copy link | **Video links** | Those videos. Short links that have expired are reported in the run summary |
| Creator links (space.bilibili.com/…), UIDs such as `546195`, or creator links shared from the app | **Creator links** | A profile row per creator, plus the videos in their public collections and series |

### Choose a ready-to-run example

- [Export Bilibili videos for a keyword with view counts](https://apify.com/cleanscrape/bilibili-scraper/examples/bilibili-videos-for-a-keyword): the top 100 videos for 咖啡 (coffee) with views, likes, coins, favorites and tags.
- [Export the danmaku of a Bilibili video](https://apify.com/cleanscrape/bilibili-scraper/examples/bilibili-video-danmaku-export): up to 2,000 bullet comments from one popular video, each with its time in the video.
- [Export a Bilibili creator's profile and videos](https://apify.com/cleanscrape/bilibili-scraper/examples/bilibili-creator-profile-and-videos): a creator's follower count and 100 videos from their public collections.
- [Read the top Bilibili comments on videos about a topic](https://apify.com/cleanscrape/bilibili-scraper/examples/bilibili-top-comments-on-a-topic): top comments and replies on 20 phone-review videos.
- [Compare Bilibili search results for several keywords](https://apify.com/cleanscrape/bilibili-scraper/examples/compare-bilibili-search-terms): 50 videos each for three terms in one table.
- [Find Bilibili videos about a product or brand](https://apify.com/cleanscrape/bilibili-scraper/examples/bilibili-videos-about-a-product): the top 50 videos for iPhone 17.

Open one, change the search term or link, and start it. Each example runs in about a minute.

### Use it from the API

Run it from Python with the Apify client (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("cleanscrape/bilibili-scraper").call(run_input={
    "searchQueries": ["咖啡"],
    "maxVideosPerQuery": 50,
    "includeDanmaku": True,
    "maxDanmakuPerVideo": 200,
})
datasets = run["storageIds"]["datasets"]  # default (videos), comments, danmaku, creators
for video in client.dataset(datasets["default"]).iterate_items():
    print(video["videoId"], video["views"], video["title"])
for danmaku in client.dataset(datasets["danmaku"]).iterate_items():
    print(danmaku["videoId"], danmaku["timeInVideoSeconds"], danmaku["text"])
```

Videos are in the run's default dataset. Comments, danmaku and creators each have their own dataset, listed under `storageIds.datasets` in the run object, and every row carries the `videoId` (or `creatorId`) to join them. The same input works from JavaScript, the REST API, schedules and integrations.

### What you get

Each kind of row has its own table (dataset): **Videos**, **Comments**, **Danmaku** and **Creators**. Comment and danmaku rows carry the video's BV id, so you can join them to the videos. Ids are stored as text so spreadsheets do not round them.

| Row type | Fields |
| --- | --- |
| Video | BV id, av id, title, description, cover, published time, length, parts, category, creator, views, likes, coins, favorites, shares, comment count, danmaku count, tags, related video ids, the search term and rank that found it |
| Comment | Video id, comment text, likes, reply count, posted time, author name, id and level, pinned flag, and for replies the comment they answer |
| Danmaku | Video id, part, time in the video, text, mode (scrolling, top, bottom), colour, font size, sent time, Bilibili's anonymised sender code |
| Creator | Name, id, link, bio, level, followers, following, video count, likes, verification, public collections and series |

### What Bilibili shows without login

This Actor collects what Bilibili shows a logged-out visitor. That means:

- **Comments are a sample.** Without login Bilibili shows the top comments of a video (usually 3) and the first 20 replies under each. The video row's `comments` column has the full count. If you need every comment of a video, this Actor is not the right tool.
- **Creator videos come from public collections and series.** Bilibili does not list a creator's full upload history to logged-out visitors. Many creators organise their videos in collections; creators who don't will have a profile row and a note in the run report.
- **Category names** are filled for videos found by search. For videos from links Bilibili leaves the name empty, so you get the category number.
- **Danmaku** is the list Bilibili's player loads for each video part, up to its limit (often 1,000–3,000 for popular videos).

### Pricing

| What | Price | When |
| --- | --- | --- |
| Video | $1.49 per 1,000 | Every saved video, with details, statistics and the tags or related videos you selected |
| Creator | $1.49 per 1,000 | Every saved creator profile |
| Comment | $0.49 per 1,000 | Every saved comment or reply, only when comments are on |
| Danmaku | $0.10 per 1,000 | Every saved danmaku, only when danmaku is on |

Examples at base prices: 100 videos with tags cost $0.15. 100 videos with top comments and replies cost about $0.64 to $1.40, because popular videos have more replies (10 to 25 comment rows per video in our tests). Danmaku adds $0.10 for every 1,000 danmaku rows; **Danmaku per video** caps it.

Platform usage is included. Your spending limit is respected: the Actor stops cleanly just before it is reached and says so in the run status. If a run is interrupted and restarted, already saved rows are not saved or charged again.

### Speed settings

**Parallel connections** (default 8) sets how many proxy IPs the run uses at once. Each one keeps to Bilibili's pace, so more connections finish sooner.

- The Actor uses your Apify Proxy. Free Apify plans include 5 datacenter IPs; extra connections are skipped automatically.
- The datacenter proxy is enough. Residential proxies are not needed and cost more.
- Running several runs at the same time shares the same proxy IPs, so one larger run is better than many parallel ones.
- `0` uses only the run's own connection. It works, but slowly, and danmaku in particular is often refused on that connection.

The run stops shortly before its timeout and ends normally, keeping everything it saved. Videos still being collected at that moment are not saved half-finished, so you are never charged for a video without the fields you asked for. The default timeout is one hour; give runs at least 2 minutes, and raise the timeout under **Run options** for very large runs.

### Run report

Each run saves a readable summary (**Output > Run summary**) with what was found per input, how many requests each field needed and whether Bilibili refused any. If Bilibili refused every connection for a field (for example danmaku), the videos are still saved and the summary and run status say which field is missing.

### Common questions

#### Is there an official Bilibili API?

Bilibili's open platform is for approved partners and for creators managing their own accounts. It is not a general API for reading any video's data. This Actor reads what the Bilibili website shows a logged-out visitor and returns it as rows you can export, or fetch from the Apify API, Python or JavaScript.

#### Do I need a Bilibili account or cookies?

No. Nothing is logged in and no cookies are needed. You need an Apify account to run the Actor.

#### How do I export Bilibili videos or danmaku to Excel or CSV?

Type a search term or paste video or creator links, turn on the data you want, and start the run. Then open **Storage > Dataset**, choose **Default** (videos), **Comments**, **Danmaku** or **Creators** in the **Dataset** menu, pick CSV, Excel or JSON and select **Download**. Each is its own table, so a download holds one kind of row. The **Export** button at the top of the run downloads the videos.

#### How much does it cost to scrape Bilibili?

$1.49 per 1,000 videos or creators, $0.49 per 1,000 comments and $0.10 per 1,000 danmaku, with no start fee and platform usage included. 100 videos with tags cost about $0.15. See **Pricing** above.

#### Can I get every comment on a video?

No. Without login Bilibili shows only the top comments (usually 3) and the first 20 replies under each. The video row has the full comment count.

#### Does it work for bilibili.tv (the international site)?

No, this Actor is for bilibili.com.

#### Why are there fewer videos than I asked for?

Bilibili shows at most 1,000 results per search term, removed or private videos are skipped (the run report counts them), and creators without public collections have no video list.

#### Is the data in Chinese?

Titles, descriptions, tags and comments are as written on Bilibili, mostly in Chinese. Column names are in English, with Bilibili's own terms next to the main ones, such as Creator (UP主), Coins (投币) and Favorites (收藏). Times are in UTC; Beijing time is UTC+8.

#### Can I paste a link from the Bilibili app?

Yes. In the app, tap **Share > Copy link** (分享 > 复制链接) and paste the whole text: the title in brackets and the b23.tv link. It works for videos and for creator pages. If a creator's link ends up under **Video links**, or a video's under **Creator links**, it is still collected.

#### Is it legal to scrape Bilibili?

The Actor collects only what Bilibili shows publicly to any visitor, at a pace Bilibili accepts. Comment and danmaku rows can include public user names and codes, which can be personal data. How you store and use the data must follow the laws that apply to you, such as the GDPR or China's PIPL, and Bilibili's terms. This is not legal advice.

Questions or a reproducible issue: contact.cleanscrape@gmail.com. CleanScrape is independent of Bilibili and Apify.

### More tools from CleanScrape

- [App Store & Google Play Reviews Scraper](https://apify.com/cleanscrape/app-store-reviews-scraper): reviews from both app stores in one table
- [Google Trends Scraper API](https://apify.com/cleanscrape/google-trends-scraper): search interest over time, by region, related queries and trending searches
- [Map Your Show Exhibitor Scraper API](https://apify.com/cleanscrape/event-exhibitor-monitor): trade show exhibitor lists and booth changes
- [Shopify Product Reviews Scraper API](https://apify.com/cleanscrape/shopify-reviews-scraper): Judge.me and Okendo reviews from Shopify product links
- [Google News Scraper API](https://apify.com/cleanscrape/google-news-scraper): headlines from Google News and publisher feeds
- [Pinterest Scraper API](https://apify.com/cleanscrape/pinterest-scraper): pins from searches, boards and profiles
- [Google Hotels Scraper API](https://apify.com/cleanscrape/google-hotels-scraper): hotel prices and booking offers for your dates
- [TikTok Shop Product Scraper](https://apify.com/cleanscrape/tiktok-shop-product-scraper): US TikTok Shop prices, sellers and ratings
- [Threads Scraper API](https://apify.com/cleanscrape/threads-scraper): public Threads posts from accounts or post links
- [Likee Scraper API](https://apify.com/cleanscrape/likee-scraper): Likee videos and comments
- [Tennis Scraper API](https://apify.com/cleanscrape/tennis-match-data): tennis results, statistics, point-by-point and head-to-head

# Actor input Schema

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

One term per line, in Chinese or English, such as 咖啡 (coffee). Chinese terms find more videos. Results come in Bilibili's default relevance order (综合排序).

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

Bilibili shows up to 1,000 results (50 pages of 20) for one term.

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

One per line: bilibili.com video links, BV ids (BV1xx411c7mD), av ids, b23.tv short links, or the whole text the Bilibili app copies with Share > Copy link (分享 > 复制链接).

## `creatorUrls` (type: `array`):

One per line: space.bilibili.com links, UIDs (the creator's number, such as 546195), or b23.tv links shared from the app. Each creator gets a profile row; their videos come from their public collections and series (合集和系列).

## `maxVideosPerCreator` (type: `integer`):

Videos taken from the creator's public collections and series. 0 saves only the profile row.

## `includeTags` (type: `boolean`):

The video's tags.

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

The comments Bilibili shows without login: usually the 3 top comments, plus the first 20 replies under each. The full comment count is in the video row.

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

Only with Top comments.

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

The on-screen comments with their time in the video, one row each.

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

Earliest in the video first. Bilibili's player list holds up to a few thousand per part.

## `danmakuAllParts` (type: `boolean`):

Off: the first part only.

## `includeRelated` (type: `boolean`):

Ids of the videos Bilibili recommends next to each video.

## `parallelConnections` (type: `integer`):

How many proxy IPs to use at once. Each keeps to Bilibili's measured pace, so more connections finish sooner. Free Apify plans include 5 datacenter IPs; extra ones are skipped automatically. 0 uses only the run's own connection (slowest).

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

Apify's datacenter proxy works well and is included in Apify plans. Residential proxies are not needed and cost more.

## Actor input object example

```json
{
  "searchQueries": [
    "咖啡"
  ],
  "maxVideosPerQuery": 100,
  "maxVideosPerCreator": 100,
  "includeTags": true,
  "includeComments": false,
  "includeReplies": true,
  "includeDanmaku": false,
  "maxDanmakuPerVideo": 1000,
  "danmakuAllParts": false,
  "includeRelated": false,
  "parallelConnections": 8,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

## `comments` (type: `string`):

No description

## `danmaku` (type: `string`):

No description

## `creators` (type: `string`):

No description

## `report` (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("cleanscrape/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("cleanscrape/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 cleanscrape/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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