# Bilibili Scraper - Videos, Comments, Danmaku 哔哩哔哩 (`pshivam/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩, B站) without login: video search, popular and ranking lists, comments with replies, danmaku (弹幕), user profiles and hot searches. Up to 1,000 videos per search. Export to Excel, CSV or API.

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

## Pricing

from $0.70 / 1,000 records

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, Danmaku 哔哩哔哩

**Get Bilibili (哔哩哔哩, B站) data as clean rows: video search with views, likes and tags, popular and ranking lists with coins and shares, comments with replies, danmaku (弹幕) with their time in the video, user profiles and hot searches. No login, no API key.** Up to 1,000 videos per search. Export to Excel, CSV, JSON or the API.

**Actively maintained.** Last update: 2026-11-15. Every release passes 70+ automated tests on real saved Bilibili answers.

### What can you use it for?

- **Track trends in China.** The popular list, the ranking of every zone and the hot search keywords, daily, with views, likes, coins and shares.
- **Research a topic or a game.** Search any Chinese or English text and get up to 1,000 videos with views, likes, danmaku counts, tags, creator and upload date. Sort by views, newest, danmaku or favorites.
- **Study audiences.** Comments (hottest or newest) with likes, replies, the writer's level and gender, and the replies under each comment.
- **Read what viewers say at each second.** Danmaku with the exact second, mode and color, ready for sentiment and highlight analysis.
- **Find creators.** User profiles with followers, following, level, video count, likes received and the verification badge.
- **Feed AI and translation pipelines.** One clean row per video, comment or danmaku in Chinese, ready for language models.

### What data can you get?

Give search texts, lists, video links or user numbers. Every row is one record, and the `type` field tells which.

| You give | You get |
|---|---|
| `searchQueries` | Videos matching each text, up to 1,000 per text, in the order you choose |
| `lists`: `popular`, `ranking`, `precious`, `hotSearch` | The popular videos, the ranking of the chosen zones, the must-watch list or today's hot keywords |
| `startUrls`: a video link or a BV or av number | That video's comments and danmaku |
| `startUrls` or `userIds`: a user link or number | The user's profile |
| `maxCommentsPerVideo`, `maxRepliesPerComment`, `maxDanmakuPerVideo` | Comments, replies and danmaku of every video found, as their own rows |

#### Fields

Rows hold every field. A field that does not apply to the record's type, or that Bilibili does not show, is `null`.

##### Record

| Field | What it is |
|---|---|
| `type` | What the record is: video, comment, danmaku, user or hotSearch. |
| `id` | The record's own number: the BV number of a video, the comment number, the danmaku number, the user number, or the day and keyword of a hot search. |
| `url` | The page of the video, the user or the hot search on Bilibili. |
| `title` | The video's title, the user's name or the hot search keyword. |
| `text` | The comment, the danmaku or the hot search keyword. E-mail addresses, links and phone numbers are replaced by \[removed]. |
| `description` | The video's description. E-mail addresses, links and phone numbers are replaced by \[removed]. |
| `coverUrl` | The video's cover picture, or the hot search's icon. |
| `publishedAt` | When the video, comment or danmaku was posted (UTC). |

##### Video

| Field | What it is |
|---|---|
| `bvid` | The video's BV number. On comments and danmaku, the video they belong to. |
| `aid` | The video's av number. On comments, the video they belong to. |
| `cid` | The number of the video part the danmaku belong to (the part list and the popular and ranking lists give it). |
| `durationSeconds` | The video's length in seconds. |
| `views` | How many times the video was played. |
| `likes` | Likes of a video or comment. On a user, the likes all their videos received. |
| `coins` | Coins viewers gave the video (popular, ranking and must-watch lists only). |
| `favorites` | How many viewers saved the video. |
| `shares` | How many times the video was shared (popular, ranking and must-watch lists only). |
| `replies` | The video's comment count, or the number of replies to a comment. |
| `danmakuCount` | How many danmaku the video holds. |
| `zone` | The video's zone (分区), for example 电子竞技. |
| `tags` | The video's tags (search results only). |
| `location` | Where the video was published from (popular, ranking and must-watch lists), or the place a comment shows. |
| `width` | The video's width in pixels (lists only). |
| `height` | The video's height in pixels (lists only). |

##### Creator, commenter or user

| Field | What it is |
|---|---|
| `authorId` | The number of the video's creator, of the comment's writer or of the user. |
| `authorName` | The name of that person. |
| `authorUrl` | Their page on Bilibili. |
| `authorAvatar` | Their profile picture. |
| `level` | The user's level (0 to 6), or the level of the comment's writer. |
| `gender` | The gender the user shows: 男, 女 or 保密 (secret). |
| `bio` | The user's profile text. E-mail addresses, links and phone numbers are replaced by \[removed]. |
| `verified` | The text of the user's verification badge, for example a company or creator title. |
| `followers` | How many people follow the user. |
| `following` | How many people the user follows. |
| `videoCount` | How many videos the user uploaded. |

##### Replies and danmaku

| Field | What it is |
|---|---|
| `parentId` | For a reply, the number of the comment it answers. |
| `timeSeconds` | Where in the video the danmaku appears, in seconds. |
| `mode` | How the danmaku moves: 1 scrolls right to left, 4 sits at the bottom, 5 sits at the top, 6 scrolls left to right, 7 is positioned. |
| `color` | The danmaku's color, for example #ffffff. |
| `userHash` | Bilibili's anonymous code of the danmaku's sender: the same sender has the same code in one video. It cannot be turned into a user number. |

##### Hot searches

| Field | What it is |
|---|---|
| `rank` | The keyword's place in the hot searches. |

##### Where it came from

| Field | What it is |
|---|---|
| `searchText` | The search text, list or zone that found the video. |
| `foundVia` | How the Actor reached the record: search, list <name>, comments, replies, danmaku or user link. |
| `page` | The page of the search or list the video was on. |
| `position` | The record's place on that page or list. |
| `totalResults` | How many results the search holds, how many comments the video has, or how many danmaku were read. |
| `sourceUrl` | The Bilibili address the record was read from. |
| `scrapedAt` | When the record was collected (UTC). |

#### Example results

Video from a search:

```json
{"type": "video", "id": "BV1VtsV6ZE9S", "bvid": "BV1VtsV6ZE9S", "aid": 117615011825159, "url": "https://www.bilibili.com/video/BV1VtsV6ZE9S", "title": "【2026KPL年总】Cat评论席 20261114", "description": "【2026KPL年总】Cat评论席 20261114", "coverUrl": "https://i1.hdslb.com/bfs/archive/844402deb8c477c5cac89af1f1212c4caed8b5af.jpg", "durationSeconds": 1151, "publishedAt": "2026-11-14T13:26:12Z", "views": 1729, "likes": 56, "favorites": 20, "replies": 3, "danmakuCount": 0, "zone": "电子竞技", "tags": ["陈正正", "CatGod", "Cat", "猫神"], "authorId": "553232", "authorName": "夏之月", "authorUrl": "https://space.bilibili.com/553232", "authorAvatar": "https://i2.hdslb.com/bfs/face/868c701b243d8c1cf823eed9b2b26dcf8894b16d.jpg", "foundVia": "search", "searchText": "cat", "page": 1, "position": 1, "totalResults": 1000, "sourceUrl": "https://api.bilibili.com/x/web-interface/search/all/v2?keyword=cat&page=1", "scrapedAt": "2026-11-15T16:00:06Z"}
```

Video from the popular list (every counter):

```json
{"type": "video", "id": "BV15es76gEgL", "bvid": "BV15es76gEgL", "aid": 117616622439632, "cid": 43611326038, "url": "https://www.bilibili.com/video/BV15es76gEgL", "title": "【2026全球总决赛】11月15日 GEN vs BLG", "description": "【2026全球总决赛】11月15日 GEN vs BLG", "coverUrl": "https://i1.hdslb.com/bfs/archive/75bd99af8766e89c599ccdfd66c36d363f9ea9bd.jpg", "durationSeconds": 19165, "publishedAt": "2026-11-14T20:17:21Z", "views": 17727266, "likes": 271493, "coins": 216034, "favorites": 86953, "shares": 12207, "replies": 54962, "danmakuCount": 231433, "zone": "电子竞技", "authorId": "50329118", "authorName": "哔哩哔哩英雄联盟赛事", "authorUrl": "https://space.bilibili.com/50329118", "authorAvatar": "https://i2.hdslb.com/bfs/face/544c89e68f2b1f12ffcbb8b3c062a3328e8692d9.jpg", "location": "上海", "width": 1280, "height": 720, "foundVia": "list popular", "searchText": "popular", "page": 1, "position": 1, "sourceUrl": "https://api.bilibili.com/x/web-interface/popular?ps=20&pn=1", "scrapedAt": "2026-11-15T16:00:06Z"}
```

Comment:

```json
{"type": "comment", "id": "1353715029", "bvid": "BV17x411w7KC", "aid": 170001, "url": "https://www.bilibili.com/video/BV17x411w7KC", "text": "妖王为了提倡节约用水，特意拍了《HOP》这部公益短片，这部短片讲述了一群男人为了节约用水而挤在一个澡盆里洗澡的故事，他们的精神可嘉，值得我们大家学习", "publishedAt": "2019-02-03T04:07:30Z", "likes": 181498, "replies": 618, "authorId": "266952687", "authorName": "君之自由", "authorUrl": "https://space.bilibili.com/266952687", "authorAvatar": "https://i0.hdslb.com/bfs/face/1379184a8c0caa875ef5bd31d30e89cf6e092f9c.jpg", "level": 6, "gender": "保密", "foundVia": "comments", "totalResults": 184331, "sourceUrl": "https://api.bilibili.com/x/v2/reply/main?type=1&oid=170001&mode=3&next=0", "scrapedAt": "2026-11-15T16:00:06Z"}
```

Danmaku:

```json
{"type": "danmaku", "id": "44635381374648323", "bvid": "BV1GJ411x7h7", "cid": 137649199, "url": "https://www.bilibili.com/video/BV1GJ411x7h7", "text": "无 敌 破 坏 王", "publishedAt": "2021-02-02T14:50:08Z", "timeSeconds": 0, "mode": 5, "color": "#f0ab2a", "userHash": "94db4968", "foundVia": "danmaku", "totalResults": 1000, "sourceUrl": "https://comment.bilibili.com/137649199.xml", "scrapedAt": "2026-11-15T16:00:06Z"}
```

User:

```json
{"type": "user", "id": "2", "url": "https://space.bilibili.com/2", "title": "碧诗", "likes": 5109221, "authorId": "2", "authorName": "碧诗", "authorUrl": "https://space.bilibili.com/2", "authorAvatar": "https://i2.hdslb.com/bfs/face/ef0457addb24141e15dfac6fbf45293ccf1e32ab.jpg", "level": 6, "gender": "男", "bio": "[removed] 直男过气网红 #  We Are Star Dust", "verified": "bilibili创始人（站长）", "followers": 1438310, "following": 430, "videoCount": 44, "foundVia": "user link", "sourceUrl": "https://api.bilibili.com/x/web-interface/card?mid=2&photo=true", "scrapedAt": "2026-11-15T16:00:06Z"}
```

### Input

| Input | What it does |
|---|---|
| `searchQueries` | Search texts, Chinese or English, one per line |
| `searchOrder`, `searchDuration` | Sort order and video length of searches |
| `lists`, `rankingZones`, `rankingType` | The lists to read, the zones of the ranking and the ranking type |
| `startUrls`, `userIds` | Video links, BV and av numbers, user links and user numbers |
| `maxCommentsPerVideo`, `commentSort`, `maxRepliesPerComment` | How many comments (hottest or newest) and replies to read per video |
| `maxDanmakuPerVideo` | How many danmaku to read per video |
| `maxItemsPerSearch` | Stop each search text and each list after this many videos |
| `onlyNew` | Skip records that earlier runs of the same input returned |
| `maxItems` | Stop after this many records in total |
| `maxConcurrency` | Pages read at the same time |
| `secondsBetweenRequests` | Pause between requests |

### How much does it cost?

You pay per record: a video, a comment, a danmaku, a user or a keyword each count as one. There is no start fee.

| Plan | Price per 1,000 records |
|---|---|
| Free | $1.00 |
| Bronze | $0.90 |
| Silver | $0.80 |
| Gold | $0.70 |

- 100 videos cost about $0.10.
- 1,000 comments cost about $1.00.
- Use `maxItems` to cap the cost of a run, and `onlyNew` to pay only for new records on scheduled runs.

### Use it via API, on a schedule, or with your tools

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("pshivam/bilibili-scraper").call(run_input={
    "searchQueries": ["原神"],
    "searchOrder": "views",
    "maxItemsPerSearch": 200,
    "maxCommentsPerVideo": 20,
})
for record in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(record["type"], record["title"] or record["text"], record["views"] or record["likes"])
```

#### Use it in Clay, n8n, Make or Zapier

Use the Actor ID `pshivam/bilibili-scraper` and an input like this:

```json
{"lists": ["popular", "hotSearch"], "maxItemsPerSearch": 50}
```

#### Watch the popular list

Schedule the Actor daily with `"lists": ["popular"]` and `onlyNew` turned on. Each run returns only videos that were not on the list before.

### Good to know

- **No login.** The Actor reads what Bilibili shows every visitor. Videos, comments and users that need an account are not returned.
- **Search returns 1,000 videos per text,** 50 pages of 20, which is Bilibili's own limit. Use more specific texts, `searchOrder` and `searchDuration` to reach different videos.
- **Video details by link are not available.** Bilibili does not give a video's own page data to visitors without login, so a video link returns its comments and danmaku. Videos found by a search or a list carry all their counters.
- **Danmaku:** Bilibili serves up to about 6,000 of a video's danmaku without login, from the first part of the video.
- **Creator uploads are not available** without login. Search the creator's name or videos instead.
- **Comments are closed on some videos.** The run message names them. They return nothing and cost nothing.
- **Bilibili can refuse requests.** The Actor waits, slows down and switches to Apify Proxy.
- **Independent tool.** Not affiliated with or endorsed by Bilibili. The Actor reads public pages that Bilibili shows to every visitor. Check Bilibili's terms before you redistribute the data.

### FAQ

#### How do I search Bilibili videos?

Put a text in `searchQueries`, for example `原神`, and raise `maxItemsPerSearch` up to 1,000. Choose `searchOrder`: most views, newest, most danmaku or most favorites.

#### How do I get the comments of a video?

Paste the video link in `startUrls` and set `maxCommentsPerVideo`. For the comments of every video a search finds, set `maxCommentsPerVideo` next to your search text.

#### What is danmaku?

Danmaku (弹幕) are the comments that scroll over the video at the second where the viewer wrote them. Set `maxDanmakuPerVideo` to read them, each with its second, mode and color.

#### Can I get the Bilibili trending list every day?

Yes. Use `lists` with `popular`, `ranking` and `hotSearch`, and schedule the Actor daily.

#### Do I need a Bilibili account or an API key?

No. The Actor never logs in.

#### Can I search in English?

Yes, but Chinese texts find far more.

#### How do I get new records only?

Turn on `onlyNew` and run the same input again later. Records that earlier runs returned are skipped and not charged.

#### Is it legal to scrape Bilibili?

The Actor reads public data that Bilibili shows without login. You are responsible for how you use the data. Check Bilibili's terms before you redistribute it.

# Actor input Schema

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

What to search for on Bilibili, one per line: Chinese (原神, 猫) or English (minecraft). Each text returns up to 1,000 videos.

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

How Bilibili sorts search results.

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

Only search videos of this length.

## `lists` (type: `array`):

Bilibili's own lists to read: popular videos, the ranking (pick zones below), the must-watch list and today's hot search keywords.

## `rankingZones` (type: `array`):

Which zones the ranking list is read for.

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

Which videos the ranking list holds.

## `startUrls` (type: `array`):

Links, one per line: a video (bilibili.com/video/BV17x411w7KC, BV or av numbers) to read its comments and danmaku, or a user (space.bilibili.com/2) for the profile.

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

Bilibili user numbers such as 2 or 946974, one per line. You get the profile with followers, level and video count.

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

Also read this many comments of every video found. 0 means none. Video links read 50 when comments and danmaku are both 0.

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

Which comments come first.

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

Also read this many replies of every comment. 0 means none. Each reply is one more record.

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

Also read this many danmaku (the scrolling comments) of every video found, from its first part. Bilibili serves up to about 6,000 of them.

## `maxItemsPerSearch` (type: `integer`):

Stop each search text and each list after this many videos. Bilibili shows 1,000 per search at most.

## `onlyNew` (type: `boolean`):

Skip records that earlier runs of this same input already returned, so you get and pay for new ones only. The first run works as usual and remembers what it returned, in your key-value store 'bilibili-scraper-only-new'.

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

Stop after this many records in total (videos, comments, danmaku, users and keywords all count). You are charged per record.

## `maxConcurrency` (type: `integer`):

How many pages are read in parallel. Raise it for large searches.

## `secondsBetweenRequests` (type: `number`):

Pause between requests. After a refusal the Actor doubles the pause and switches to Apify Proxy when it can.

## Actor input object example

```json
{
  "searchQueries": [
    "原神"
  ],
  "searchOrder": "relevance",
  "searchDuration": "any",
  "lists": [],
  "rankingZones": [
    "all"
  ],
  "rankingType": "all",
  "maxCommentsPerVideo": 0,
  "commentSort": "hot",
  "maxRepliesPerComment": 0,
  "maxDanmakuPerVideo": 0,
  "maxItemsPerSearch": 100,
  "onlyNew": false,
  "maxItems": 100,
  "maxConcurrency": 5,
  "secondsBetweenRequests": 0.1
}
```

# Actor output Schema

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

Videos as a table.

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

Comments as a table.

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

Danmaku as a table.

## `users` (type: `string`):

Users as a table.

## `runStats` (type: `string`):

Requests made, time spent and number of records for this run (RUN_STATS record).

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

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

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

```

## MCP server setup

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