# Bilibili Comments Scraper - Comments & Replies (`kodenova/bilibili-comments-scraper`) Actor

Scrape Bilibili (哔哩哔哩) video comments and replies: text, likes, reply count, author, user level and date. Hot or newest order, pinned comments included. No login, pay only per comment.

- **URL**: https://apify.com/kodenova/bilibili-comments-scraper.md
- **Developed by:** [Kodenova studio](https://apify.com/kodenova) (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.80 / 1,000 comment 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 Comments Scraper - Comments & Replies (哔哩哔哩评论)

Export **Bilibili video comments and replies** to JSON, CSV or Excel: comment text, likes, reply count, author, user level and date. Built for sentiment analysis, brand and product monitoring in China, influencer research and AI training data. **No login, no cookies, no browser** — and about **3× cheaper** than other Bilibili comment scrapers.

**What you get**

- **Comment:** text, likes, reply count, publish date, pinned flag, attached images
- **Author:** name, user ID, profile link, Bilibili level, avatar (IP location when Bilibili shows it publicly)
- **Thread:** replies (楼中楼) with root/parent IDs, plus the video's BV ID, title and URL

### Sample output

```json
{
  "commentId": "245632146672",
  "text": "孩子们课代表来了 简约? 1.查看文件扩展名 2.版本推荐 3.安装python",
  "likes": 7571,
  "replyCount": 1161,
  "publishedAt": "2024-11-21T13:52:41.000Z",
  "authorName": "爱劳动的noise",
  "authorId": "1242205079",
  "authorUrl": "https://space.bilibili.com/1242205079",
  "authorLevel": 4,
  "ipLocation": null,
  "images": [],
  "isReply": false,
  "isPinned": false,
  "rootCommentId": null,
  "parentCommentId": null,
  "videoBvid": "BV1rpWjevEip",
  "videoAid": 113006243481679,
  "videoTitle": "【全748集】目前B站最全最细的Python零基础全套教程",
  "videoUrl": "https://www.bilibili.com/video/BV1rpWjevEip",
  "scrapedAt": "2026-10-18T10:00:00.000Z"
}
```

### How to use (3 steps)

1. Paste one or more **Bilibili video URLs** (or BV / av IDs).
2. Choose **hot or newest** order and how many comments per video; tick **Include replies** if you need threads.
3. Click **Start**, then download JSON, CSV, Excel — or call it via API / MCP.

### Input

| Field | What it does | Example |
|---|---|---|
| `videoUrls` | Videos to scrape | `["BV1rpWjevEip"]` |
| `sortBy` | `hot` (popular) or `newest` | `"newest"` |
| `maxCommentsPerVideo` | Top-level comments per video | `500` |
| `includeReplies` | Also scrape replies under each comment | `true` |
| `maxRepliesPerComment` | Replies per comment | `20` |
| `maxItems` | Hard cap for the whole run | `5000` |

### Pricing in plain words

Pay per result: **about $3 per 1,000 comments** (replies count as results too), plus a tiny start fee. 100 comments ≈ $0.30. Higher Apify plans get automatic discounts. No monthly rental.

### FAQ

**Do I need a Bilibili account or cookies?** No. Only public comments are collected.

**How do I scrape all comments of a Bilibili video?** Set *Max comments per video* to the comment count shown on the video and turn on *Include replies*.

**Can I monitor new comments daily?** Yes — choose *Newest first*, set a small limit (e.g. 100) and schedule the Actor in Apify.

**Why are some videos skipped?** The uploader disabled comments, or the video is deleted/private. The run continues with the other videos.

**I get 412 errors.** Bilibili rate-limits some data-center IPs. Re-run with the proxy set to *RESIDENTIAL*.

**Is it legal?** It collects publicly visible comments only. Use the data in line with Bilibili's terms and privacy laws in your country (GDPR, PIPL); don't use it to profile private individuals.

### Use via API / MCP

```bash
curl -X POST "https://api.apify.com/v2/acts/kodenova~bilibili-comments-scraper/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls":["BV1rpWjevEip"],"maxCommentsPerVideo":200,"sortBy":"newest"}'
```

AI agents (Claude, ChatGPT, Cursor) can call it through the Apify MCP server: `https://mcp.apify.com/?tools=kodenova/bilibili-comments-scraper`.

### Related Actors

- [Bilibili Scraper - Videos, Search & Trending](https://apify.com/kodenova/bilibili-scraper) — find videos by keyword, then feed their URLs here
- Bilibili Creator (UP主) Scraper *(coming soon)*

Need a custom scraper for another Chinese or Asian platform? Open an issue on this Actor.

# Actor input Schema

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

Bilibili video links or IDs, e.g. https://www.bilibili.com/video/BV1rpWjevEip, BV1rpWjevEip or av170001.

## `sortBy` (type: `string`):

Hot = Bilibili's popular order. Newest = latest comments first (good for monitoring).

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

Top-level comments to collect per video.

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

Also collect replies (楼中楼) under each comment. Each reply is a separate result.

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

Only used when Include replies is on.

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

Run stops after this many comments + replies in total. You only pay per result saved.

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

Apify Proxy is used by default. Switch to RESIDENTIAL only if you see repeated 412 blocks.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.bilibili.com/video/BV1rpWjevEip"
  ],
  "sortBy": "hot",
  "maxCommentsPerVideo": 100,
  "includeReplies": false,
  "maxRepliesPerComment": 10,
  "maxItems": 500,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

All scraped items in the default dataset.

## `runSummary` (type: `string`):

Success rate and error counts for this run.

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

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

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

```

## MCP server setup

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