# Bilibili Scraper & API - Videos, Comments, Danmaku 哔哩哔哩 (`kalilfagundes.w/bilibili-scraper`) Actor

\[Limited Launch Offer $1.5/1K] Bilibili video search, comments and danmaku without login: keyword search, video details by URL/BV, UP主 creators and uploads, popular and ranking lists. B站 data API.

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

## Pricing

from $1.28 / 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.
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 & API - Videos, Comments, Danmaku (哔哩哔哩 / B站)

Scrape **Bilibili** (哔哩哔哩, B站), China's biggest video community, without login or cookies. Search videos by keyword
(Chinese or English), get full details for any video link, list a creator's (UP主) latest uploads with their profile,
pull the popular feed or the top-100 ranking, and collect **comments** and **danmaku (弹幕 bullet comments)** for every
video found - all in one run. Export to JSON, CSV or Excel, or call it as an API.

### What you get

- **Videos**: title, description, cover, length, publish time, category, tags, uploader, views, likes, coins,
  favorites, shares, comment and danmaku counts, BV/av id, cid, parts.
- **Comments**: text, likes, reply count, author (UID, name, level, avatar), time, pictures, and replies with their parent.
- **Danmaku**: text, the second in the video where it appears, color, mode, font size, sent time, sender hash.
- **Creators**: followers, following, video count, total likes, level, verification title, bio, avatar.

### Why this scraper

- **Everything in one run**: mix keywords, video links, creators and a trending list - no "mode" switch per run.
- **Raw danmaku rows**, timestamped to the second of the video - ideal for reaction and highlight analysis.
- **Search filters**: sort by relevance, views, newest, danmaku, favorites or comments; video length; publish date range;
  up to 1,000 videos per keyword (Bilibili's own cap).
- **Accepts any link format**: `BV…` ids, `av…` ids, full URLs, `b23.tv` short links, creator UIDs, `space.bilibili.com`
  links or exact creator names.
- **Low price** per row (see Pricing) and no browser: fast and light.

### Use cases

- Brand and product monitoring in China (gaming, anime, consumer electronics, EV, beauty).
- Influencer (KOL / UP主) discovery and tracking: followers, upload cadence, engagement per video.
- Audience sentiment from comments and danmaku for NLP / AI datasets.
- Trend research from the popular feed and the all-site ranking.

### Input example

```json
{
  "searchQueries": ["黑神话", "Genshin Impact"],
  "searchSort": "views",
  "maxVideosPerSearch": 100,
  "videoUrls": ["https://www.bilibili.com/video/BV1nyeGz6EVs"],
  "creators": ["https://space.bilibili.com/946974"],
  "maxVideosPerCreator": 30,
  "trending": "popular",
  "maxCommentsPerVideo": 50,
  "maxDanmakuPerVideo": 200,
  "maxItems": 2000
}
```

### Output example

```json
[
  {
    "type": "video",
    "bvid": "BV17x411w7KC",
    "aid": 170001,
    "url": "https://www.bilibili.com/video/BV17x411w7KC",
    "title": "【MV】保加利亚妖王AZIS视频合辑",
    "description": "sina 保加利亚超级天王 Azis1999年出道。他的音乐融合保加利亚名族曲风chalga和pop、rap等元素，不过他惊艳的易装秀与浮夸的角色诠释才是他最为出名的地方 Azis与众多保加利亚天王天后级歌手都有过合作.06年，他作为Mariana Popova的伴唱，在欧洲半决赛上演唱了他们的参赛曲Let Me Cr…",
    "coverUrl": "https://i2.hdslb.com/bfs/archive/1ada8c32a9d168e4b2ee3e010f24789ba3353785.jpg",
    "durationSec": 2412,
    "publishedAt": "2011-11-09T14:55:33Z",
    "category": null,
    "tags": [
      "保加利亚妖王",
      "保加利亚",
      "Азис",
      "azis",
      "mv"
    ],
    "authorMid": 122541,
    "authorName": "冰封.虾子",
    "authorFaceUrl": "https://i0.hdslb.com/bfs/face/40c46ee74dd6ea33d46c38cd6083e6a1286aa482.gif",
    "viewCount": 45819454,
    "danmakuCount": 915673,
    "commentCount": 184130,
    "favoriteCount": 877099,
    "coinCount": 294971,
    "shareCount": 42742298,
    "likeCount": 943174,
    "partsCount": 10,
    "cid": 279786,
    "isOriginal": false,
    "rank": null,
    "source": "video",
    "input": "170001",
    "scrapedAt": "2026-10-09T01:17:54Z"
  },
  {
    "type": "comment",
    "commentId": "273399537456",
    "rootCommentId": null,
    "parentCommentId": null,
    "isReply": false,
    "text": "接下来请选择你的英雄：\n黑神话·哪吒\n黑神话·杨戬\n黑神话·盘古\n黑神话·济公\n黑神话·许仙[doge_金箍][doge_金箍][doge_金箍]",
    "likeCount": 4944,
    "replyCount": 303,
    "createdAt": "2025-08-20T16:05:41Z",
    "authorMid": 693997440,
    "authorName": "花雨剑ovo",
    "authorLevel": 6,
    "authorFaceUrl": "https://i0.hdslb.com/bfs/face/ddb1e5c6461a6f03755464ca44e4d524a22fbb05.jpg",
    "ipLocation": null,
    "pictures": [],
    "videoBvid": "BV1nyeGz6EVs",
    "videoUrl": "https://www.bilibili.com/video/BV1nyeGz6EVs",
    "videoTitle": "《黑神话：钟馗》预告片解析——捉山中鬼易，斩心中鬼难！【毒舌的南瓜】",
    "source": "comments",
    "input": "BV1nyeGz6EVs",
    "scrapedAt": "2026-10-09T01:19:44Z"
  },
  {
    "type": "danmaku",
    "videoTimeSec": 20.85,
    "mode": 1,
    "fontSize": 25,
    "color": "#ffffff",
    "sentAt": "2026-10-07T07:03:31Z",
    "senderHash": "e7539434",
    "danmakuId": "2216818946467122432",
    "text": "啊？今夕何年？",
    "videoBvid": "BV1BTpP6eEfR",
    "videoUrl": "https://www.bilibili.com/video/BV1BTpP6eEfR",
    "videoTitle": "【黑神话悟空 Reaction】做一个先驱，撒下燎原的种子",
    "source": "danmaku",
    "input": "黑神话",
    "scrapedAt": "2026-10-09T01:21:37Z"
  },
  {
    "type": "creator",
    "mid": 946974,
    "name": "影视飓风",
    "url": "https://space.bilibili.com/946974",
    "sign": "无限进步！｜商务合作请联系邮箱：bd@ysjf.com（邮件中麻烦备注公司、咨询内容）｜店铺名：影视飓风",
    "faceUrl": "https://i0.hdslb.com/bfs/face/c1733474892caa45952b2c09a89323157df7129a.jpg",
    "level": 6,
    "sex": "男",
    "followerCount": 18599469,
    "followingCount": 686,
    "videoCount": 947,
    "likeCount": 128414115,
    "isVerified": true,
    "verifiedTitle": "2025百大UP主、2023年度最高人气奖UP主、课堂优质讲师",
    "vipType": 2,
    "source": "creator",
    "input": "946974",
    "scrapedAt": "2026-10-09T01:16:30Z"
  }
]
```

Every row has `type` (`video`, `comment`, `danmaku` or `creator`), `source`, the `input` that found it and `scrapedAt`.
Dates are ISO 8601 in UTC. The dataset has ready-made views for videos, comments, danmaku and creators.

### Run it on a schedule and connect it to your tools

**Schedule:** in Apify Console open *Schedules → Create*, pick this actor and your input, and set it to run
every Monday at 07:00 (your time zone) for a fresh dataset on a fixed day. Each run returns the full, current result set as a new dataset.

**Integrations** (Actor → *Integrations* tab, no code):

- **Google Sheets** — append every run's rows to a sheet.
- **Make, Zapier, n8n** — start the actor from a scenario/zap/workflow and use the rows in the next steps.
- **Webhook** — get a POST to your endpoint when a run succeeds, then download the dataset.
- **Slack / email** — notify your team when a scheduled run finishes.

**AI agents (MCP)** — Claude, ChatGPT, Cursor, VS Code or any MCP client can run it as a tool: add the Apify MCP
server `https://mcp.apify.com?actors=kalilfagundes.w/bilibili-scraper` (sign in with your Apify account) and ask for the data in
plain language. The agent fills the input from the input schema and reads the dataset back.

**API** — call it from your code (`pip install apify-client` / `npm i apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("kalilfagundes.w/bilibili-scraper").call(run_input={
    "searchQueries": [
        "Genshin Impact"
    ],
    "searchSort": "views",
    "maxVideosPerSearch": 45,
    "videoUrls": [
        "https://www.bilibili.com/video/BV1nyeGz6EVs"
    ],
    "creators": [
        "https://space.bilibili.com/946974"
    ],
    "maxVideosPerCreator": 12,
    "trending": "popular",
    "maxTrendingVideos": 25,
    "maxCommentsPerVideo": 0,
    "maxItems": 200
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('kalilfagundes.w/bilibili-scraper').call({
  "searchQueries": [
    "Genshin Impact"
  ],
  "searchSort": "views",
  "maxVideosPerSearch": 45,
  "videoUrls": [
    "https://www.bilibili.com/video/BV1nyeGz6EVs"
  ],
  "creators": [
    "https://space.bilibili.com/946974"
  ],
  "maxVideosPerCreator": 12,
  "trending": "popular",
  "maxTrendingVideos": 25,
  "maxCommentsPerVideo": 0,
  "maxItems": 200
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Pricing

Pay only for the rows you get (launch offer, lower on higher Apify plans):

| Row | Price |
|---|---|
| Video | $1.50 per 1,000 |
| Comment | $0.50 per 1,000 |
| Danmaku | $0.20 per 1,000 |
| Creator profile | $2 per 1,000 |
| Run start | $0.002 |

Example: 1,000 videos with 20 comments each = $1.50 + $10 = $11.50. `maxItems` and the per-input limits cap every run.

### Limits and FAQ

- **Comments without login**: Bilibili shows guests only the first page of comments - the top and the newest
  top-level comments (up to about 40 per video) and the first 20 replies of each. The scraper collects all of that.
- **Danmaku**: Bilibili serves the latest danmaku pool of each video (1,500 for most videos, more for long ones).
- **Search** returns at most 1,000 videos per keyword; use several keywords or date ranges for more.
- **Creator uploads** come newest first with full stats (one request per video).
- Requests start without a proxy and switch to a fresh proxy IP when Bilibili rate-limits a session.
- Only public data is collected. No login, cookies or CAPTCHA solving.

Questions or a missing field? Open an issue on the Issues tab - feedback is answered quickly.

### Related actors

- [Douyin Scraper 抖音 - Video, Comments, Profile & Hot Search](https://apify.com/kalilfagundes.w/douyin-scraper)
- [Weibo Scraper - Hot Search, Posts, Comments & Profiles 微博](https://apify.com/kalilfagundes.w/weibo-scraper)
- [Meta Threads Scraper - Posts, Replies, Profiles & Hashtags](https://apify.com/kalilfagundes.w/threads-scraper)

# Actor input Schema

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

Videos matching each keyword, Chinese or English (e.g. 人工智能, "Genshin Impact"). Bilibili returns up to 1,000 videos per keyword.

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

Links like https://www.bilibili.com/video/BV1nyeGz6EVs, BV ids, av ids or b23.tv short links. Returns full details for each video.

## `creators` (type: `array`):

Creator (UP主) UIDs like 946974, space links like https://space.bilibili.com/946974, or exact names. Returns a profile row and the latest uploads.

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

Also scrape Bilibili's popular feed or the all-site top-100 ranking.

## `searchSort` (type: `string`):

Order of search results.

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

Only videos of this length (search only).

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

Search only: videos published on or after this date, YYYY-MM-DD (Beijing time).

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

Search only: videos published on or before this date, YYYY-MM-DD.

## `maxVideosPerSearch` (type: `integer`):

Up to 1,000 (Bilibili's cap per keyword).

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

Latest uploads per creator. 0 = only the profile row.

## `maxTrendingVideos` (type: `integer`):

Videos from the trending list (ranking has 100).

## `fullVideoDetails` (type: `boolean`):

Adds coins, shares, all tags, parts and cid to search and creator results (one extra request per video). Video URLs and trending lists always have them.

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

Comments for every video found: top and newest comments plus their replies (without login Bilibili shows up to about 40 top-level comments and 20 replies each). 0 = no comments.

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

Also save replies to each comment.

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

Bullet comments (弹幕) for every video found, in video-time order: text, second in the video, color, sent time. Bilibili serves up to 1,500-8,000 per video. 0 = no danmaku.

## `includeCreatorProfile` (type: `boolean`):

One row per creator: followers, following, videos, likes, level, verification, bio.

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

Stop after this many rows (videos + comments + danmaku + creators). 0 = no limit.

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

Used when Bilibili rate-limits a session: the session restarts on a new proxy IP.

## Actor input object example

```json
{
  "searchQueries": [
    "黑神话"
  ],
  "trending": "none",
  "searchSort": "relevance",
  "searchDuration": "any",
  "maxVideosPerSearch": 20,
  "maxVideosPerCreator": 30,
  "maxTrendingVideos": 50,
  "fullVideoDetails": false,
  "maxCommentsPerVideo": 0,
  "includeReplies": true,
  "maxDanmakuPerVideo": 0,
  "includeCreatorProfile": true,
  "maxItems": 1000,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

OUTPUT record: per input, rows saved and errors.

# 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": [
        "黑神话"
    ],
    "maxVideosPerSearch": 20,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kalilfagundes.w/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": ["黑神话"],
    "maxVideosPerSearch": 20,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("kalilfagundes.w/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": [
    "黑神话"
  ],
  "maxVideosPerSearch": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call kalilfagundes.w/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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