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

Extract public Bilibili video comments and nested replies for social listening, creator research, and AI datasets.

- **URL**: https://apify.com/fetch\_cat/bilibili-comments-replies-scraper.md
- **Developed by:** [Hanna Nosova](https://apify.com/fetch_cat) (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 $0.30 / 1,000 comment or reply rows

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Bilibili Comments & Replies Scraper

Extract public comments and nested replies from known Bilibili videos. Provide BVIDs or video URLs and get structured rows for social listening, creator research, brand monitoring, market research, and AI dataset preparation.

### What does this Actor do?

Bilibili comment threads contain buyer opinions, fandom reactions, creator feedback, and product/community signals. This Actor turns public Bilibili comment and reply text into clean, exportable rows with stable IDs and parent-child links.

- Scrapes public top-level Bilibili video comments.
- Optionally collects bounded nested replies for each comment.
- Resolves video metadata such as BVID, AID, title, and owner name.
- Preserves parent-child relationships with `rpid`, `rootRpid`, and `parentRpid`.
- Supports anonymization of public commenter fields while keeping a stable hash.

### Who uses it / use cases

**Social listening teams:** monitor public audience reactions under campaign or brand videos.

**Creator researchers:** study comment engagement, frequent topics, and reply chains.

**Market researchers:** export Chinese video-platform discussion data for qualitative analysis.

**AI dataset builders:** collect public CJK/emoji-rich conversation text with timestamps and IDs.

### Input settings

| Field | Description |
| --- | --- |
| `bvidsOrUrls` | Public Bilibili BVIDs or video URLs to process. |
| `maxCommentsPerVideo` | Maximum top-level comments to save per video. |
| `includeReplies` | Whether to fetch nested replies. |
| `maxRepliesPerComment` | Maximum replies to save per top-level comment. |
| `sort` | `hot` or `time`. |
| `anonymizeUsers` | Removes member ID, name, and avatar URL while keeping `memberHash`. |
| `requestDelayMillis` | Delay between API requests. |
| `maxRequestRetries` | Retries for transient API/HTTP failures. |
| `proxyConfiguration` | Optional Apify proxy settings; direct HTTP is the default. |

### Input example

```json
{
  "bvidsOrUrls": ["BV1xx411c7mD"],
  "maxCommentsPerVideo": 25,
  "includeReplies": true,
  "maxRepliesPerComment": 2,
  "sort": "hot",
  "anonymizeUsers": false,
  "requestDelayMillis": 500,
  "maxRequestRetries": 3,
  "proxyConfiguration": { "useApifyProxy": false }
}
````

### Input recipes

- **Known video comments:** set `includeReplies` to `false` and `maxCommentsPerVideo` to 25.
- **Comments with replies:** set `includeReplies` to `true` and `maxRepliesPerComment` to 2-5.
- **Anonymized research:** set `anonymizeUsers` to `true` before sharing datasets.

### Output fields

Each dataset item is a public comment or reply row.

| Field | Description |
| --- | --- |
| `sourceUrl`, `bvid`, `aid` | Source input and resolved video identifiers. |
| `videoTitle`, `videoOwnerName` | Public video metadata. |
| `commentType` | `comment` or `reply`. |
| `rpid`, `rootRpid`, `parentRpid` | Stable Bilibili comment/reply IDs and linkage. |
| `message`, `createdAt`, `likeCount`, `replyCount` | Comment text and engagement metadata. |
| `memberMid`, `memberName`, `memberLevel`, `memberAvatarUrl`, `memberHash` | Public commenter fields or anonymized hash. |
| `sort`, `isReply`, `repliesTruncated` | Extraction context and truncation flags. |
| `apiCode`, `apiMessage`, `scrapedAt` | Diagnostics and scrape timestamp. |

### Output example

```json
{
  "sourceUrl": "BV1xx411c7mD",
  "bvid": "BV1xx411c7mD",
  "aid": 2,
  "videoTitle": "Example Bilibili video",
  "commentType": "reply",
  "rpid": "1234567890",
  "rootRpid": "1234567000",
  "parentRpid": "1234567000",
  "message": "Public comment text",
  "createdAt": "2026-07-18T08:00:00.000Z",
  "likeCount": 12,
  "memberHash": "a1b2c3d4e5f6a7b8",
  "isReply": true,
  "scrapedAt": "2026-07-18T08:01:00.000Z"
}
```

### Pricing

This Actor uses pay-per-event pricing:

- **Start:** `$0.005` per run.
- **Comment or reply row:** tiered by Apify plan, with Bronze at `$0.0005` per saved dataset item (about `$0.50 / 1,000` rows).

| Tier | Price per comment/reply row |
| --- | ---: |
| Free | $0.000575 |
| Bronze | $0.000500 |
| Silver | $0.000390 |
| Gold | $0.000300 |
| Platinum | $0.000200 |
| Diamond | $0.000140 |

You are not charged per result for invalid inputs that produce no dataset rows.

### API examples

#### Node.js

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('fetch_cat/bilibili-comments-replies-scraper').call({
  bvidsOrUrls: ['BV1xx411c7mD'],
  maxCommentsPerVideo: 10,
});
console.log(run.defaultDatasetId);
```

#### Python

```python
from apify_client import ApifyClient
client = ApifyClient('YOUR_APIFY_TOKEN')
run = client.actor('fetch_cat/bilibili-comments-replies-scraper').call(run_input={
    'bvidsOrUrls': ['BV1xx411c7mD'],
    'maxCommentsPerVideo': 10,
})
print(run['defaultDatasetId'])
```

#### cURL

```bash
curl -X POST 'https://api.apify.com/v2/acts/fetch_cat~bilibili-comments-replies-scraper/runs?token=YOUR_APIFY_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"bvidsOrUrls":["BV1xx411c7mD"],"maxCommentsPerVideo":10}'
```

### MCP / AI agents

Use this Actor from Apify MCP tools or agent workflows when an AI system needs public Bilibili comment rows. Keep limits small for interactive analysis, and enable `anonymizeUsers` when sending data to external LLMs or shared workspaces.

**Claude CLI add command:**

```bash
claude mcp add apify-bilibili-comments -- npx -y @apify/actors-mcp-server --actors fetch_cat/bilibili-comments-replies-scraper
```

**JSON config block:**

```json
{
  "mcpServers": {
    "apify-bilibili-comments": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server", "--actors", "fetch_cat/bilibili-comments-replies-scraper"],
      "env": { "APIFY_TOKEN": "YOUR_APIFY_TOKEN" }
    }
  }
}
```

**Example prompts:**

- "Scrape 20 public comments from BV1xx411c7mD and summarize recurring themes."
- "Collect Bilibili comments with anonymized users for this video URL."
- "Get comments and one nested reply per comment, then export the dataset ID."

### FAQ

**Does it scrape private or logged-in content?** No. It only uses public Bilibili video/comment endpoints.

**Can it discover videos by keyword?** No. Use the related video search Actor first, then pass selected BVIDs here.

**Why are there zero rows for a video?** The video may be unavailable, comments may be disabled, or Bilibili may return no public comments for the requested sort/region.

### Responsible use

This actor collects only public Bilibili video comments and replies. Do not use it for private, logged-in, paid, or restricted content. Comments can contain personal or user-generated content; use `anonymizeUsers` when sharing datasets or building AI/sentiment workflows.

### Related Actors

- [Bilibili Video Search Scraper](https://apify.com/fetch_cat/bilibili-video-search-scraper) for discovering videos before collecting comments.

### Support

If you need help, open an issue on the Actor page and include:

- input JSON;
- expected output;
- actual output;
- reproducible public URL (for example a Bilibili video URL) or BVID;
- Apify run ID.

# Actor input Schema

## `bvidsOrUrls` (type: `array`):

One or more public Bilibili video URLs or BVID identifiers.

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

Maximum number of top-level comments to save for each input video.

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

Fetch replies under each top-level comment when available.

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

Maximum number of nested replies to save under each top-level comment.

## `sort` (type: `string`):

Choose Bilibili hot/recommended comments or newest comments first.

## `anonymizeUsers` (type: `boolean`):

Remove public display names, avatar URLs, and member IDs while keeping a stable member hash.

## `requestDelayMillis` (type: `integer`):

Politeness delay between Bilibili API requests.

## `maxRequestRetries` (type: `integer`):

Retry count for transient HTTP/API errors.

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

Optional Apify proxy configuration. Direct HTTP is used by default.

## Actor input object example

```json
{
  "bvidsOrUrls": [
    "BV1xx411c7mD"
  ],
  "maxCommentsPerVideo": 20,
  "includeReplies": true,
  "maxRepliesPerComment": 5,
  "sort": "hot",
  "anonymizeUsers": false,
  "requestDelayMillis": 500,
  "maxRequestRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (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 = {
    "bvidsOrUrls": [
        "BV1xx411c7mD"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetch_cat/bilibili-comments-replies-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 = { "bvidsOrUrls": ["BV1xx411c7mD"] }

# Run the Actor and wait for it to finish
run = client.actor("fetch_cat/bilibili-comments-replies-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "bvidsOrUrls": [
    "BV1xx411c7mD"
  ]
}' |
apify call fetch_cat/bilibili-comments-replies-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=fetch_cat/bilibili-comments-replies-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bilibili Comments & Replies Scraper",
        "description": "Extract public Bilibili video comments and nested replies for social listening, creator research, and AI datasets.",
        "version": "0.1",
        "x-build-id": "sjRuAg0HQopmw3Vtq"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/fetch_cat~bilibili-comments-replies-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-fetch_cat-bilibili-comments-replies-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/fetch_cat~bilibili-comments-replies-scraper/runs": {
            "post": {
                "operationId": "runs-sync-fetch_cat-bilibili-comments-replies-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/fetch_cat~bilibili-comments-replies-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-fetch_cat-bilibili-comments-replies-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "bvidsOrUrls"
                ],
                "properties": {
                    "bvidsOrUrls": {
                        "title": "Bilibili video URLs or BVIDs",
                        "type": "array",
                        "description": "One or more public Bilibili video URLs or BVID identifiers.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxCommentsPerVideo": {
                        "title": "Max top-level comments per video",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of top-level comments to save for each input video.",
                        "default": 20
                    },
                    "includeReplies": {
                        "title": "Include nested replies",
                        "type": "boolean",
                        "description": "Fetch replies under each top-level comment when available.",
                        "default": true
                    },
                    "maxRepliesPerComment": {
                        "title": "Max replies per top-level comment",
                        "minimum": 0,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of nested replies to save under each top-level comment.",
                        "default": 5
                    },
                    "sort": {
                        "title": "Comment sort order",
                        "enum": [
                            "hot",
                            "time"
                        ],
                        "type": "string",
                        "description": "Choose Bilibili hot/recommended comments or newest comments first.",
                        "default": "hot"
                    },
                    "anonymizeUsers": {
                        "title": "Anonymize public commenter fields",
                        "type": "boolean",
                        "description": "Remove public display names, avatar URLs, and member IDs while keeping a stable member hash.",
                        "default": false
                    },
                    "requestDelayMillis": {
                        "title": "Delay between API requests (ms)",
                        "minimum": 0,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Politeness delay between Bilibili API requests.",
                        "default": 500
                    },
                    "maxRequestRetries": {
                        "title": "Max request retries",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Retry count for transient HTTP/API errors.",
                        "default": 3
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optional Apify proxy configuration. Direct HTTP is used by default.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
