# Bilibili Video & Comment Scraper (CN) (`myagizm/bilibili-scraper`) Actor

Login-less Bilibili (bilibili.com) video and comment scraper: video search, video details, top-level comments, user profiles and uploader videos. No account needed; guest-access limits are documented.

- **URL**: https://apify.com/myagizm/bilibili-scraper.md
- **Developed by:** [MYM](https://apify.com/myagizm) (community)
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 result items

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 (CN)

Login-less Bilibili (bilibili.com) data via a private scraping backend — this Actor is a thin bridge and contains no scraping code.

### Modes

| Mode | Input | Output |
|---|---|---|
| `search` | `keyword`, `pages` (≤10), `order`, `duration` | video rows: title, url, duration, views, likes, coins, favorites, replies, danmaku, tags, uploader |
| `video_detail` | `videos` (URL / BV id / aid) | per-video detail: tags, reply count; full view stats when the network allows |
| `video_comments` | `videos`, `maxComments` (≤500) | top-level comments with author, likes, location, first replies |
| `user_profile` | `users` (space URL / mid) | name, avatar, sign, level, followers, following, likes received, video count |
| `user_videos` | `users`, optional `name`, `pages`, `maxVideos` | that uploader's videos found via search, exact-id filtered |

### Known limitations (measured, 2026-09-20)

- **Comments without login**: from datacenter networks Bilibili returns only the top ~3 comments per video even when the real count is huge. Full comment paging needs login cookies or clean/residential egress — not included.
- **Video detail is partial on datacenter egress**: the view-statistics endpoint is risk-control blocked (HTTP 412 / guest-masked -404). Items still include tags and the exact reply count; the blocked part is reported in run errors.
- **user\_videos is NOT an exhaustive listing**: it searches the uploader's name and keeps only exact uploader-id matches. The direct uploads listing endpoint is blocked on datacenter egress.
- **Rate limiting**: rapid search bursts intermittently get HTTP 412. Requests are paced (~0.35–0.6 s gap) and retried with bounded backoff (max 3 attempts/request), then fail with a classified error.
- No login, no cookies, no danmaku download, no media files.

### Input

See the Input tab — the schema mirrors the backend contract 1:1. Invalid input (wrong mode, missing keyword/lists) fails the run immediately, before any scraping, so you never pay for a malformed request.

### Output

One dataset item per video / comment / user. Run notes (per-input errors and the limits above) are printed to the run log and stored in the `STATS` value, not billed as items.

# Actor input Schema

## `mode` (type: `string`):

search: videos by keyword. video\_detail: metadata + tags + comment count per video. video\_comments: top-level comments per video. user\_profile: profile card per user. user\_videos: recent uploads per user (via uploader-search, NOT an exhaustive listing).

## `keyword` (type: `string`):

Keyword for search mode (Chinese or any language). Required when mode=search.

## `videos` (type: `array`):

Bilibili video references for video\_detail / video\_comments: full URLs (bilibili.com/video/BV...), BV ids, or numeric aids.

## `users` (type: `array`):

Bilibili user references for user\_profile / user\_videos: space.bilibili.com/<mid> URLs or numeric mids.

## `name` (type: `string`):

user\_videos only: the uploader's display name. Skips one profile lookup when provided; if omitted it is resolved automatically from the mid.

## `pages` (type: `integer`):

Pages to fetch for search / user\_videos (20 results per page).

## `maxComments` (type: `integer`):

video\_comments only: hard cap per video. NOTE: without login Bilibili returns only the top few comments per video from datacenter networks, so the real yield can be much lower than this cap.

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

user\_videos only: hard cap per user (search fallback, non-exhaustive).

## `order` (type: `string`):

search only: result ordering.

## `duration` (type: `integer`):

search only: 0=all, 1=<10min, 2=10-30min, 3=30-60min, 4=>60min.

## Actor input object example

```json
{
  "mode": "search",
  "videos": [],
  "users": [],
  "pages": 1,
  "maxComments": 100,
  "maxVideos": 100,
  "duration": 0
}
```

# Actor output Schema

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

All scraped items as structured JSON.

# 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 = {
    "videos": [],
    "users": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("myagizm/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 = {
    "videos": [],
    "users": [],
}

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

```

## MCP server setup

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