# Bilibili Video & Search Scraper (`bovi/bilibili-scraper`) Actor

Collect public Bilibili video search results, video details, creator profiles and relation stats, comments, danmaku, and subtitle metadata. Supports an optional input proxy and requires no account or API key.

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

## Pricing

from $2.00 / 1,000 bilibili video & search scrapers

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

Collect public video and creator data from bilibili.com. Choose one operation for each run: video detail, creator profile, relation statistics, creator videos, comments, danmaku, subtitle metadata, or keyword search. The actor reads Bilibili's page data and public endpoints. It does not sign in or require an API key.

### Input

Set operation to one of: videoDetail, userDetail, userRelationStat, userVideos, videoComments, videoDanmu, videoCaption, or searchVideo. Provide the matching identifier: keyword for searchVideo, bvid for videoDetail or videoCaption, userId for creator operations, aid for comments, and aid plus cid for danmaku. maxResults defaults to 50 and is a hard cap on rows written. maxPages defaults to 5 for paginated operations.

The optional proxyConfiguration input is passed through Apify's proxy configuration. If omitted or disabled, requests use a direct connection. Bilibili may return an anti-bot page for some addresses. The actor detects challenge pages and fails the affected run instead of treating them as collected records.

### Example input

```
{
  "operation": "searchVideo",
  "keyword": "python",
  "maxResults": 10,
  "maxPages": 2,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

### Example output

```
{
  "_operation": "searchVideo",
  "_fetchedAt": "2026-10-13T11:53:52.960437+00:00",
  "status": "success",
  "_page": 1,
  "title": "【全748集】目前B站最全最细的Python零基础全套教程，2026最新版，包含所有干货！七天就能从小白到大神！少走99%的弯路！存下吧！很难找全的！",
  "videoTitle": "【全748集】目前B站最全最细的Python零基础全套教程，2026最新版，包含所有干货！七天就能从小白到大神！少走99%的弯路！存下吧！很难找全的！",
  "url": "https://www.bilibili.com/video/BV1rpWjevEip/",
  "videoPageUrl": "https://www.bilibili.com/video/BV1rpWjevEip/",
  "bvid": "BV1rpWjevEip",
  "userName": "Python官方课程",
  "playCountDisplay": "2074万",
  "playCount": 20740000,
  "durationStr": "39:58:14",
  "durationSec": 143894
}
```

This example is an actual search row from the local run. Rows include only source-backed values and normalized aliases; fields missing from a response are omitted. Search-card counts are rounded labels supplied by Bilibili. Detail-page counts come from the page's embedded state. IDs are stored as strings when needed to preserve full precision.

### Pricing

This actor uses pay-per-result billing: each dataset row is billed once by the Apify platform. The champion's Bronze-tier reference rates are $0.004 per search result, $0.04 per video detail or creator profile, $0.025 per relation-stat row, $0.003 per creator-video row, $0.004 per comment, $0.002 per danmaku row, and $0.03 per subtitle-metadata row. These are reference rates only; the actual rate is configured on the Store listing. The actor does not call Actor.charge.

# Actor input Schema

## `operation` (type: `string`):

Choose one operation for this run.

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

Keyword for searchVideo. Chinese, English, and mixed terms are accepted.

## `bvid` (type: `string`):

Bilibili BV identifier for videoDetail and videoCaption.

## `aid` (type: `string`):

Numeric video ID for videoComments and videoDanmu.

## `cid` (type: `string`):

Numeric part ID for videoDanmu.

## `userId` (type: `string`):

Numeric UP主 ID for userDetail, userRelationStat, and userVideos.

## `maxResults` (type: `integer`):

Maximum number of dataset rows this run may write.

## `maxPages` (type: `integer`):

Page limit for search, creator video lists, and comments.

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

Optional Apify proxy settings. An omitted or disabled proxy uses a direct connection.

## Actor input object example

```json
{
  "operation": "searchVideo",
  "keyword": "python",
  "bvid": "BV1rpWjevEip",
  "aid": "113006243481679",
  "cid": "36010133667",
  "userId": "3546597933714079",
  "maxResults": 50,
  "maxPages": 5,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `output` (type: `string`):

Structured rows collected from public Bilibili pages and endpoints.

# 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 = {
    "operation": "searchVideo",
    "keyword": "python",
    "bvid": "BV1rpWjevEip",
    "aid": "113006243481679",
    "cid": "36010133667",
    "userId": "3546597933714079",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bovi/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 = {
    "operation": "searchVideo",
    "keyword": "python",
    "bvid": "BV1rpWjevEip",
    "aid": "113006243481679",
    "cid": "36010133667",
    "userId": "3546597933714079",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("bovi/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 '{
  "operation": "searchVideo",
  "keyword": "python",
  "bvid": "BV1rpWjevEip",
  "aid": "113006243481679",
  "cid": "36010133667",
  "userId": "3546597933714079",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call bovi/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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