# Bilibili Scraper – Videos, Stats, Comments & Danmaku (`phantom-x64/bilibili-scraper`) Actor

Extract Bilibili (B站) videos with views, likes, coins, favorites, shares, tags and top comments. Search by keyword, scrape video URLs, creator (UP主) uploads, popular videos and danmaku. No login or cookies. $2.50 per 1,000 videos.

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

## Pricing

from $2.50 / 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, stats, comments, creators (UP主) & danmaku (no login)

**Bilibili scraper (哔哩哔哩 / B站) for Chinese video data.** Search Bilibili videos by keyword, scrape any video URL, all uploads of a creator (UP主) or the popular/trending list, and export **full video stats** — views, likes, coins, favorites, shares, comments and danmaku counts — plus tags, parts, uploader followers, **top comments with replies**, **creator profiles** and **danmaku (bullet comments)**. No Bilibili account, no cookies to paste, no browser: it works like an anonymous visitor of bilibili.com, through Bilibili's own public web API.

- ✅ **4 ways in**: keyword search, video URLs / BV / av ids / b23.tv links, creators (UID, space URL or name), popular list
- ✅ **Top comments with reply threads**: text, likes, date, user name, level and VIP status
- ✅ **Complete stats** for every video: views, likes, coins, favorites, shares, comments, danmaku, highest rank, honors
- ✅ **Creator (UP主) profiles**: followers, following, videos, total likes, level, verification, live room status
- ✅ **Danmaku (弹幕)** with the exact second of the video, color, mode and send date — all parts of multi-part videos
- ✅ Search filters: sort (best match, most viewed, newest, most danmaku, most favorited), video length, date range
- ✅ Clean flat JSON with English field names — export to CSV, Excel, Google Sheets or use it as a **Bilibili API** from your code
- ✅ **$2.50 per 1,000 videos, no start fee** — up to 8× cheaper than the most used Bilibili actor

### What can this Bilibili scraper do?

| Use case | How |
|---|---|
| **Influencer & KOL marketing in China** | Find creators for a keyword, compare followers, views, likes and coins per video; build shortlists for campaigns. |
| **Brand & product monitoring** | Search your brand or product (e.g. `iPhone 17 评测`, `原神`) daily with "Newest" + "Published after: 1 day" and see what Chinese viewers say in the top comments and danmaku. |
| **Competitor & content research** | Scrape every upload of a creator sorted by views to learn which topics, titles and lengths work on Bilibili. |
| **Trend analysis** | Track the popular list (热门) and the tags of trending videos over time. |
| **Market research & academia** | Collect Chinese video metadata and audience reactions for studies on media, gaming, anime and consumer trends. |
| **AI / LLM & NLP datasets** | Danmaku and comments are a rich source of Chinese short-text sentiment data. |

### Quick start (under 1 minute)

1. Click **Try for free**. The pre-filled input searches Bilibili for `lofi` and returns 10 videos with their top comments.
2. Replace the keyword, or add video URLs, creator (UP主) links or numeric ids. Turn on danmaku only when you need it.
3. Click **Start**. The default run takes about 30 seconds. Download JSON, CSV or Excel, or call it through the Apify API.

### Input

| Field | What it does |
|---|---|
| `searchQueries` | Keywords to search, like the search box on bilibili.com (any language). |
| `startUrls` | Video URLs, BV/av ids, b23.tv short links, `space.bilibili.com/<UID>`, `search.bilibili.com/all?keyword=...`, `bilibili.com/v/popular/all`. |
| `creators` | UID (`946974`), space URL, or creator name. |
| `scrapePopular` | Also scrape the popular / trending list. |
| `maxVideos` | Max videos per keyword, per creator and for the popular list (default 20). |
| `videoDetails` | Full stats, tags, parts and uploader followers for every video (default on). |
| `searchOrder`, `searchDuration` | Sort and length filters of Bilibili search. |
| `creatorVideoOrder` | Creator uploads: newest, most viewed or most favorited first. |
| `dateFrom` / `dateTo` | `2026-10-01`, an ISO date-time, or relative values like `7 days`. |
| `includeComments`, `maxCommentsPerVideo`, `commentSort`, `includeCommentReplies` | Pinned + top comments and their reply threads. |
| `includeDanmaku`, `maxDanmakuPerVideo` | Bullet comments of every part of the video. |
| `includeCreatorInfo`, `includeUploaderInfo` | Profile rows for the creators you ask for / for every uploader found. |
| `proxyConfiguration` | Apify Proxy (datacenter usually works; residential if you see many blocks). |

#### Example: search a keyword, newest videos of the last 7 days, with comments

```json
{
  "searchQueries": ["原神", "honkai star rail"],
  "searchOrder": "pubdate",
  "dateFrom": "7 days",
  "maxVideos": 100,
  "includeComments": true,
  "maxCommentsPerVideo": 20
}
```

#### Example: a creator's most viewed videos + profile

```json
{
  "creators": ["946974", "https://space.bilibili.com/546195"],
  "creatorVideoOrder": "click",
  "maxVideos": 50,
  "includeComments": false
}
```

#### Example: danmaku of specific videos

```json
{
  "startUrls": ["https://www.bilibili.com/video/BV1TxxC6vEo4", "https://b23.tv/xxxxxxx"],
  "includeDanmaku": true,
  "maxDanmakuPerVideo": 5000,
  "includeComments": false
}
```

### Output

Every row has a `type`: `video`, `comment`, `creator`, `danmaku` or `error` (errors are free). Real sample (shortened):

```json
{
  "type": "video",
  "bvid": "BV1sixi6yEFA",
  "aid": 117530270107952,
  "url": "https://www.bilibili.com/video/BV1sixi6yEFA",
  "title": "Lofi Girl｜8小时万圣节歌单Halloween Lofi 🎃...",
  "cover_url": "https://i1.hdslb.com/bfs/archive/dc3b5d6a8bb22f40009fb015dd41363c1a87e2f5.jpg",
  "duration_seconds": 28801,
  "published_at": "2026-10-30T14:33:40Z",
  "category_id": 2024,
  "tags": ["万圣节", "歌单", "CHILL", "LOFI"],
  "views": 6924, "likes": 505, "coins": 88, "favorites": 508, "shares": 27,
  "comments_count": 19, "danmaku_count": 0,
  "parts_count": 1,
  "collection_title": "🎃Halloween Lofi",
  "uploader_mid": 1685650605,
  "uploader_name": "LofiGirl",
  "uploader_followers": 180549,
  "uploader_video_count": 281,
  "uploader_verified": true,
  "source": "url",
  "scraped_at": "2026-11-02T14:31:40Z"
}
```

```json
{
  "type": "creator",
  "mid": 1685650605,
  "url": "https://space.bilibili.com/1685650605",
  "name": "LofiGirl",
  "bio": "网易云音乐/QQ音乐/酷狗音乐/酷我音乐/Apple Music ...",
  "level": 6,
  "verified": true,
  "verification_title": "Lofi Girl官方账号",
  "followers": 180549, "following": 12, "video_count": 281, "total_likes": 175098,
  "is_live": true,
  "live_room_url": "https://live.bilibili.com/27519423"
}
```

```json
{
  "type": "comment",
  "video_bvid": "BV1sixi6yEFA",
  "comment_id": "318681668353",
  "root_comment_id": null,
  "is_pinned": false,
  "text": "...",
  "likes": 21,
  "reply_count": 0,
  "published_at": "2026-10-30T14:49:52Z",
  "user_mid": 372598062, "user_name": "厄沉", "user_level": 6, "user_vip": true,
  "url": "https://www.bilibili.com/video/BV1sixi6yEFA#reply318681668353"
}
```

```json
{
  "type": "danmaku",
  "video_bvid": "BV1xx411c7XX",
  "cid": 3661050,
  "part": 1,
  "danmaku_id": "903052424",
  "time_seconds": 0.0,
  "text": "歌词神马的事亮点",
  "mode": "scroll",
  "font_size": 25,
  "color": "#FFFFFF",
  "sent_at": "2011-08-30T03:11:27Z",
  "user_hash": "f4dbdf21",
  "pool": "normal"
}
```

**Video fields:** `bvid`, `aid`, `cid`, `url`, `title`, `description`, `cover_url`, `duration_seconds`, `published_at`, `uploaded_at`, `category`, `category_id`, `copyright`, `tags`, `views`, `likes`, `coins`, `favorites`, `shares`, `comments_count`, `danmaku_count`, `highest_rank`, `honors`, `parts_count`, `parts`, `width`, `height`, `subtitle_languages`, `collection_title`, `is_paid`, `is_interactive`, `staff`, `uploader_mid`, `uploader_name`, `uploader_url`, `uploader_avatar`, `uploader_followers`, `uploader_video_count`, `uploader_total_likes`, `uploader_level`, `uploader_verified`, `uploader_verification`, `popular_reason`, `publish_location` (popular list), `source`, `source_rank`, `details_level`, `scraped_at`.

**Comment fields:** `video_bvid`, `video_aid`, `video_title`, `comment_id`, `root_comment_id`, `reply_to_comment_id`, `is_reply`, `is_pinned`, `text`, `pictures`, `mentions`, `likes`, `reply_count`, `published_at`, `liked_by_uploader`, `replied_by_uploader`, `user_mid`, `user_name`, `user_avatar`, `user_level`, `user_vip`, `url`.

**Creator fields:** `mid`, `url`, `name`, `avatar_url`, `bio`, `level`, `sex`, `birthday`, `verified`, `verification_title`, `vip`, `followers`, `following`, `video_count`, `article_count`, `total_likes`, `is_live`, `live_room_url`, `live_title`, `live_viewers_text`, `banner_url`.

**Danmaku fields:** `video_bvid`, `video_title`, `cid`, `part`, `danmaku_id`, `time_seconds`, `text`, `mode`, `font_size`, `color`, `sent_at`, `user_hash`, `weight`, `pool`.

### Pricing

Pay per event — you only pay for rows you get, never for errors or for starting the actor:

| Event | Price |
|---|---|
| Video (full stats) | **$0.0025** ($2.50 per 1,000) |
| Comment or reply | **$0.0005** ($0.50 per 1,000) |
| Creator profile | **$0.003** ($3.00 per 1,000) |
| Danmaku | **$0.0001** ($0.10 per 1,000) |
| Run start / error rows | **free** |

Examples: 1,000 videos with full stats ≈ **$2.50**. 100 videos + 20 comments each ≈ **$1.25**. The default input (10 videos + their top comments) costs about **$0.05** and finishes in under a minute. Set "Max cost per run" in the run options to cap any run — the scraper stops cleanly when it is reached. A video found by two keywords is charged once.

### FAQ

**Do I need a Bilibili account or cookies?** No. The scraper creates a fresh anonymous visitor session (the same cookies bilibili.com gives any browser) and signs requests the way the website does. You never share your account.

**Why do I get only some comments per video?** Bilibili shows logged-out visitors only the pinned comment, the top (hot) comments and the first replies under each of them; the full thread needs a logged-in account, and this actor never logs in. In our tests that is the pinned comment, about 3 top comments and up to 20 replies under each — up to roughly 80 comments per video, ranked like on the website. `comments_count` on the video row always gives the real total.

**How many search results can I get?** Bilibili search returns up to 1,000 videos (50 pages) per keyword. Use several related keywords, the date range or the length filter to go further.

**How much danmaku can I get?** The full public danmaku of each video part (read in 6-minute segments, the same way the Bilibili player loads it), up to your `maxDanmakuPerVideo`.

**What about blocks?** Bilibili has strict rate limits for its creator pages. When a request is blocked, the scraper waits, opens a new visitor session (new cookies and new proxy IP) and retries; for creator uploads it automatically switches to a second public list endpoint. Keep the default delay and use Apify Proxy; switch to residential proxies only if the log shows many blocks.

**Why is `category` sometimes empty?** Bilibili's video page API no longer returns the category name for many videos; you always get `category_id`, and the name when search or the popular list provides it.

**Can it download the video files or subtitles?** No — this actor focuses on data (metadata, stats, comments, danmaku). `subtitle_languages` tells you which subtitle tracks exist.

**Is it legal?** It only reads data that Bilibili shows to any visitor without logging in, without solving captchas or bypassing paywalls. You are responsible for how you use the data (e.g. data-protection rules for personal data such as user names).

**Is this an official Bilibili API?** No. It is an independent tool — an easy, no-code alternative to the Bilibili API for public video, creator and comment data.

### Limits

- Logged-out visitors see roughly 80 comments per video (pinned comment, top comments and their first replies). `comments_count` always has the real total.
- Keyword search is capped by Bilibili at 1,000 videos (50 pages) per keyword. Use several keywords or a date range to go further.
- No video or subtitle downloads: the Actor returns data (stats, tags, comments, danmaku). `subtitle_languages` lists the tracks that exist.
- Bilibili rate-limits creator pages. The Actor waits, rotates sessions and retries, so very large creator crawls take longer.

### Use it from code (API)

Every Apify Actor is also an API. Replace `<YOUR_API_TOKEN>` with the token from your Apify account (Settings, API & Integrations).

**JavaScript**

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

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('phantom-x64/bilibili-scraper').call({
    "searchQueries": [
      "lofi"
    ],
    "scrapePopular": false,
    "maxVideos": 20
  });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient('<YOUR_API_TOKEN>')
run = client.actor('phantom-x64/bilibili-scraper').call(run_input={
      "searchQueries": [
        "lofi"
      ],
      "scrapePopular": False,
      "maxVideos": 20
    })
items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)
```

You can also start it from Make, Zapier, n8n or Google Sheets with the Apify integrations, schedule it, or call it as a tool from an AI agent through the Apify MCP server.

### Support and feedback

Found a bug, need a new field or another source? Open an issue in the **Issues** tab of this Actor page. Reports with a run link are fixed fastest. If it saves you time, a short review on the Store page helps other people find it.

# Actor input Schema

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

Search Bilibili videos by keyword, exactly like the search box on bilibili.com. Chinese, English or any language (e.g. 原神, lofi, iPhone 17 评测). Each keyword returns up to "Max videos per source" videos.

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

Bilibili links or ids: video URLs (https://www.bilibili.com/video/BV1xx411c7mD), BV ids, av ids, b23.tv short links, creator pages (https://space.bilibili.com/946974), search URLs (https://search.bilibili.com/all?keyword=...) or the popular page (https://www.bilibili.com/v/popular/all).

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

Creators whose uploads you want: numeric UID (946974), space URL (https://space.bilibili.com/946974) or exact creator name (the best match of Bilibili's user search is used). Returns the creator profile (optional) and their latest videos.

## `scrapePopular` (type: `boolean`):

Also scrape the current Bilibili popular / trending list (https://www.bilibili.com/v/popular/all), up to "Max videos per source" videos.

## `maxVideos` (type: `integer`):

Maximum videos per search keyword, per creator and for the popular list (Bilibili search returns at most 1,000 results per keyword). Video URLs are always scraped. Set 0 to get only creator profiles.

## `videoDetails` (type: `boolean`):

Open every video to get the complete stats (views, likes, coins, favorites, shares, comments, danmaku), all tags, parts, subtitles languages and the uploader's follower count. Turn off for faster runs that only keep the fields shown in search results / upload lists.

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

Order of search results.

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

Only return search results of this length.

## `creatorVideoOrder` (type: `string`):

Which uploads of each creator to take first: newest, most viewed or most favorited.

## `dateFrom` (type: `string`):

Only videos published on or after this date (search and creator uploads). Accepts YYYY-MM-DD, an ISO date-time or a relative value such as "7 days", "24 hours" or "2 weeks". Leave empty for no limit.

## `dateTo` (type: `string`):

Only videos published on or before this date (a plain YYYY-MM-DD includes the whole day). Same formats as "Published after". Leave empty for no limit.

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

Add comment rows for every video: the pinned comment, the top comments and their replies, with likes, date, user id, name, level and VIP status. Note: Bilibili shows only the first top comments and their reply threads to visitors who are not logged in; this actor never logs in.

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

Maximum comment rows per video (top comments plus replies).

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

Hot (most liked first, like the default Bilibili view) or newest first.

## `includeCommentReplies` (type: `boolean`):

Also return the replies under each top comment (counted in "Max comments per video").

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

Add the bullet comments (danmaku) shown over the video: text, second of the video, color, mode, send date and anonymous user hash. Covers every part of multi-part videos.

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

Maximum danmaku rows per video (sorted by time in the video).

## `includeCreatorInfo` (type: `boolean`):

For every creator in "Creators" (or creator URL), add one profile row: name, bio, followers, following, video count, total likes, level, verification, live room status.

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

Also add a creator profile row for the uploader of every video found by search, URL or popular list (one row per unique creator).

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

How many videos/sources are processed at the same time. Each worker uses its own anonymous visitor session.

## `requestDelayMs` (type: `integer`):

Minimum pause between two requests of the same worker, in milliseconds (a small random jitter is added). Lower values are faster but trigger Bilibili's rate limits sooner.

## `maxRetries` (type: `integer`):

How many times a blocked or failed request is retried with a new visitor session (new cookies and proxy IP) and exponential backoff.

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

Apify Proxy is recommended. Datacenter proxies usually work; switch to Residential if you see many "blocked" retries in the log.

## Actor input object example

```json
{
  "searchQueries": [
    "lofi"
  ],
  "scrapePopular": true,
  "maxVideos": 10,
  "videoDetails": true,
  "searchOrder": "totalrank",
  "searchDuration": "0",
  "creatorVideoOrder": "pubdate",
  "includeComments": true,
  "maxCommentsPerVideo": 10,
  "commentSort": "hot",
  "includeCommentReplies": true,
  "includeDanmaku": false,
  "maxDanmakuPerVideo": 500,
  "includeCreatorInfo": true,
  "includeUploaderInfo": false,
  "maxConcurrency": 3,
  "requestDelayMs": 700,
  "maxRetries": 5,
  "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": [
        "lofi"
    ],
    "scrapePopular": false,
    "maxVideos": 10,
    "maxCommentsPerVideo": 10,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("phantom-x64/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": ["lofi"],
    "scrapePopular": False,
    "maxVideos": 10,
    "maxCommentsPerVideo": 10,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("phantom-x64/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": [
    "lofi"
  ],
  "scrapePopular": false,
  "maxVideos": 10,
  "maxCommentsPerVideo": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call phantom-x64/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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