# Bilibili Scraper (`datascrapers/bilibili-scraper`) Actor

Delivers a structured dataset of Bilibili videos and creator profiles. Query by category, search keyword, or video URL for titles, URLs, BVIDs, covers, view and like counts, durations, and publish times, plus optional video and creator details.

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

## Pricing

from $1.70 / 1,000 posts

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 Scraper** creates a structured dataset of Bilibili videos and PGC titles collected from Popular/Ranking categories, search keywords, or pasted Bilibili URLs. Each dataset item represents one primary video or season, with its title, URL, BVID, cover, play/like/comment counts, duration, publish time, and creator name and URL; when enabled, it also attaches a `videoDetails` object, a `creatorDetails` profile, and a nested `creatorVideos` list. Query using `startUrls`, `searchQueries`, or `categories`, cap results with `maxItems`, and retrieve records through the Apify Dataset API or export them as JSON, CSV, Excel, HTML, or XML.

### Dataset at a glance

| Property | Value |
|---|---|
| Source | Bilibili.com |
| Record unit | One primary video or PGC season |
| Input methods | `startUrls`, `searchQueries`, `categories` |
| Main identifiers | `bvid`, `aid`, `url` |
| Delivery | Apify Dataset and API |
| Export formats | JSON, CSV, Excel, HTML, XML |
| Update model | Fresh records per Actor run |
| Pricing | Pay-per-event: $2.00 / 1,000 posts; optional details billed per event |

### Coverage and available records

The Actor accepts three seed types, processed in the same run and combinable:

- **Page URLs** (`startUrls`) — video pages (`/video/BVxxx`), creator spaces (`space.bilibili.com`), category hubs, search pages, and bangumi seasons.
- **Search queries** (`searchQueries`) — free-text keywords such as `原神`, `LOL`, or `美食`; each query is paginated until `maxItems` is reached.
- **Categories** (`categories`) — built-in sections: `popular`, `ranking`, `anime`, `movie`, `tv`, `variety`, `documentary`, `guochuang`, `entertainment`, `douga`, `music`, `dance`, `game`, `knowledge`, `tech`, `sports`, `life`, `food`, `fashion`, `cinephile`.

Conditional enrichment is controlled by three booleans, all disabled by default:

- `scrapeVideoDetails` attaches a `videoDetails` object (description, tags, coins, favorites, shares, danmaku).
- `scrapeCreatorStats` attaches a `creatorDetails` profile (followers, following, upload count, level, bio, sex).
- `scrapeCreatorVideos` attaches a nested `creatorVideos` list; `maxCreatorVideos` (default `10`) limits uploads per creator, and `0` collects all.

`maxItems` caps primary videos from search, URLs, or categories (`0` = unlimited). Nested `creatorVideos` entries do not count toward this limit and do not become new dataset rows. Creator space URLs already scrape uploads as primary rows, so the nested list is not duplicated onto those rows.

### Data dictionary

| Field | Type | Nullable | Description | Example |
|---|---:|---|---|---|
| `itemType` | string | No | Record kind: `video` or `pgc` | `"video"` |
| `url` | string | No | Public Bilibili URL for this primary item | `"https://www.bilibili.com/video/BV13mt76GEfr/"` |
| `bvid` | string | Yes | BV id | `"BV13mt76GEfr"` |
| `aid` | integer | Yes | Numeric archive id | `117199473809637` |
| `title` | string | No | Video or season title | `"每 天 一 遍 🔥 烦 恼 拜 拜！"` |
| `coverUrl` | string | Yes | Cover image URL | `"https://i0.hdslb.com/bfs/archive/..."` |
| `playCount` | integer | Yes | Play count | `2109736` |
| `likeCount` | integer | Yes | Like count | `63082` |
| `commentCount` | integer | Yes | Comment count | `1499` |
| `durationSeconds` | integer | Yes | Duration in seconds | `74` |
| `publishedAt` | string | Yes | Publish time (UTC ISO-8601) | `"2026-09-02T04:25:00+00:00"` |
| `creatorName` | string | Yes | Uploader display name | `"兔总裁s"` |
| `creatorUrl` | string | Yes | Uploader space URL | `"https://space.bilibili.com/15385187"` |
| `sourceType` | string | No | How this item was discovered | `"category"` |
| `sourceValue` | string | Yes | Discovery source value | `"popular"` |
| `videoDetails` | object | Yes | Extra video/season fields; present only when `scrapeVideoDetails` is on | see below |
| `creatorDetails` | object | Yes | Creator profile; present only when `scrapeCreatorStats` is on | see below |
| `creatorVideos` | array | Yes | That creator's uploads; present only when `scrapeCreatorVideos` is on | see below |

The optional `videoDetails` object carries `description`, `tags`, `categoryName`, `playCount`, `likeCount`, `commentCount`, `danmakuCount`, `coinCount`, `favoriteCount`, `shareCount`, `durationSeconds`, `publishedAt`, and — for PGC titles — `seasonId`, `episodeId`, `rating`, and `subtitle`.

The optional `creatorDetails` object carries `creatorFaceUrl`, `creatorName`, `creatorUrl`, `creatorId`, `followerCount`, `followingCount`, `videoCount`, `level`, `sex`, and `sign`.

Each entry in the optional `creatorVideos` array carries `coverUrl`, `url`, `title`, `playCount`, `commentCount`, `durationSeconds`, `publishedAt`, and `bvid`.

The best stable field for deduplication is `bvid`, with `aid` (or season id when `bvid` is absent) and `url` as fallbacks.

### Example dataset record

The following representative record was produced from the `popular` category with `scrapeVideoDetails`, `scrapeCreatorStats`, and `scrapeCreatorVideos` all enabled. Identifiers and values are real output; the top-level `creatorId` seen in some runs is omitted here because it is not part of the documented schema.

```json
{
  "itemType": "video",
  "url": "https://www.bilibili.com/video/BV13mt76GEfr/",
  "bvid": "BV13mt76GEfr",
  "aid": 117199473809637,
  "title": "每 天 一 遍 🔥 烦 恼 拜 拜！",
  "coverUrl": "https://i0.hdslb.com/bfs/archive/64c8c613267236c595ce27a7e52ebb36cc33be20.jpg",
  "playCount": 2109736,
  "likeCount": 63082,
  "commentCount": 1499,
  "durationSeconds": 74,
  "publishedAt": "2026-09-02T04:25:00+00:00",
  "creatorName": "兔总裁s",
  "creatorUrl": "https://space.bilibili.com/15385187",
  "sourceType": "category",
  "sourceValue": "popular",
  "videoDetails": {
    "description": "一个月没古法健身了！！！\n感恩素材：武当十三",
    "tags": [],
    "danmakuCount": 1040,
    "coinCount": 5272,
    "favoriteCount": 13970,
    "shareCount": 2669,
    "playCount": 2109736,
    "likeCount": 63082,
    "commentCount": 1499,
    "durationSeconds": 74,
    "publishedAt": "2026-09-02T04:25:00+00:00"
  },
  "creatorDetails": {
    "creatorId": 15385187,
    "creatorName": "兔总裁s",
    "creatorUrl": "https://space.bilibili.com/15385187",
    "followerCount": 2047556,
    "followingCount": 92,
    "videoCount": 227,
    "level": 6,
    "sign": "做自由且快乐的自己～",
    "sex": "女"
  },
  "creatorVideos": [
    {
      "url": "https://www.bilibili.com/video/BV13mt76GEfr/",
      "bvid": "BV13mt76GEfr",
      "title": "每 天 一 遍 🔥 烦 恼 拜 拜！",
      "coverUrl": "https://i0.hdslb.com/bfs/archive/64c8c613267236c595ce27a7e52ebb36cc33be20.jpg",
      "playCount": 2109736,
      "commentCount": 1499,
      "durationSeconds": 74,
      "publishedAt": "2026-09-02T04:25:00+00:00"
    }
  ]
}
```

### Query and input reference

| Input | Type | Required | Default | Accepted values | Description |
|---|---:|---|---|---|---|
| `startUrls` | array | No\* | prefill: Popular URL | Bilibili page URLs | Video, creator space, category, search, or bangumi URLs. |
| `searchQueries` | array | No\* | prefill: `["原神"]` | free text | Keywords searched on Bilibili; each is paginated until `maxItems`. |
| `categories` | array | No\* | `[]` (prefill: `["popular"]`) | `popular`, `ranking`, `anime`, `movie`, `tv`, `variety`, `documentary`, `guochuang`, `entertainment`, `douga`, `music`, `dance`, `game`, `knowledge`, `tech`, `sports`, `life`, `food`, `fashion`, `cinephile` | Built-in Bilibili sections to scrape. |
| `maxItems` | integer | No | `0` | `0` = unlimited | Maximum primary videos from search, URLs, or categories. |
| `scrapeVideoDetails` | boolean | No | `false` | `true` / `false` | Attach a `videoDetails` object per row. |
| `scrapeCreatorVideos` | boolean | No | `false` | `true` / `false` | Attach a `creatorVideos` list per row. |
| `maxCreatorVideos` | integer | No | `10` | `0` = all | Uploads attached per creator in `creatorVideos`. |
| `scrapeCreatorStats` | boolean | No | `false` | `true` / `false` | Attach a `creatorDetails` object per row. |
| `proxyConfiguration` | object | No | Apify `RESIDENTIAL` | proxy config | Proxy settings; residential recommended. |

\*Provide at least one of `startUrls`, `searchQueries`, or `categories`. A minimal request and an advanced request:

```json
{ "categories": ["popular"], "maxItems": 20 }
```

```json
{
  "startUrls": [{ "url": "https://www.bilibili.com/video/BV1Kthg69E9K/" }],
  "searchQueries": ["原神"],
  "categories": ["popular"],
  "maxItems": 50,
  "scrapeVideoDetails": true,
  "scrapeCreatorVideos": true,
  "maxCreatorVideos": 10,
  "scrapeCreatorStats": true,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

### Retrieve the data through the API

1. Start the Actor with a JSON input.
2. Wait for the run to finish, or use the synchronous `?waitForFinish=` endpoint when appropriate.
3. Read items from the run's default dataset.
4. Paginate or export the dataset.

A Python example using the Apify client:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("datascrapers/bilibili-scraper").call(
    run_input={"categories": ["popular"], "maxItems": 20}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item["playCount"], item["creatorName"])
```

For other languages, use the generated API tab on the Actor page. Never place a real token in a URL or example.

### Data quality and record handling

- **Conditional fields** — `videoDetails`, `creatorDetails`, and `creatorVideos` are present only when the corresponding option is enabled. PGC rows may omit `bvid` and `aid` in favor of season identifiers.
- **Completeness** — listing-only rows omit the detail objects; individual counts and timestamps can be empty when the source does not expose them.
- **Deduplication** — within a run, videos are deduplicated by `bvid` (or `aid` / season id when `bvid` is missing). Re-runs can repeat the same video; deduplicate across runs on `bvid` or `url`.
- **Retries** — individual items fail soft, so one failed request does not stop the run; residential proxies reduce blocking.
- **Normalization** — `publishedAt` is UTC ISO-8601; counts are numeric; `itemType` is normalized to `video` or `pgc`.
- **Raw versus derived** — all fields are source values; the Actor does not compute engagement rates or convert currencies.

### Export and pipeline examples

| Destination | Recommended method | Typical use |
|---|---|---|
| PostgreSQL / Supabase | Dataset API or webhook consumer | Video and creator history storage |
| Google Sheets | Apify integration | Popular/Ranking snapshots for reporting |
| S3 / cloud storage | Scheduled export or integration | Daily trending archives |
| BI / analytics | Scheduled run + export | Engagement and creator trend analysis |

### Pricing and cost examples

Billing is pay-per-event. Each primary video or season written to the dataset triggers the `dataset-item` ("Post") event; a one-time `apify-actor-start` event ($0.00005) is applied per run.

| Event | What counts | Rate (per 1,000) |
|---|---|---|
| `dataset-item` (Post) | Each primary video or season saved | $2.00 |
| `video-details` | Each row with a `videoDetails` object | $2.00 |
| `creator-details` | Each row with a `creatorDetails` object | $1.50 |
| `creator-videos` | Each nested upload in `creatorVideos` | $2.00 |

Higher Apify plan tiers apply a discount (per 1,000 posts): Bronze $1.90, Silver $1.80, Gold/Platinum/Diamond $1.70. Creator-details tiers are $1.40 / $1.30 / $1.20.

| Records | Estimated base cost |
|---:|---:|
| 1,000 posts (listing only) | $2.00 |
| 10,000 posts (listing only) | $20.00 |
| 1,000 posts with video details | $4.00 |
| 1,000 posts with creator details | $3.50 |

Estimates assume the standard tier and selected options; extras are billed only when enabled and data is attached. Failed rows and empty extras are not charged.

### Limitations and responsible data use

- The Actor collects publicly accessible Bilibili.com video and creator data only.
- Play, like, and comment counts reflect the source at crawl time and change continuously.
- Some fields are conditional or empty (see Data quality).
- No historical snapshots are guaranteed unless you store the exported datasets yourself.
- You are responsible for complying with applicable privacy, contractual, and legal requirements when using the data.

### Dataset questions

#### What does one dataset item represent?

One primary Bilibili video (`itemType: "video"`) or PGC season (`itemType: "pgc"`), optionally enriched with a `videoDetails` object, a `creatorDetails` profile, and a nested `creatorVideos` list.

#### Which field should I use as a unique identifier?

Use `bvid`; fall back to `aid` (or the season id when `bvid` is absent) and `url` for PGC titles.

#### Are fields nullable or conditional?

Yes. `videoDetails`, `creatorDetails`, and `creatorVideos` are conditional on their respective options, and several identifier and count fields can be empty when the source does not expose them.

#### Can I retrieve the records as CSV or JSON?

Yes. Download JSON, CSV, Excel, or HTML from the Apify Console Storage tab, or pull JSON items from the Dataset API.

#### How do I paginate large datasets?

`maxItems` caps primary videos across all sources (`0` = unlimited). Nested `creatorVideos` are stored on the same row and do not consume the cap; limit them with `maxCreatorVideos`.

#### What counts as a billable result?

Each primary video or season is one `dataset-item` charge. Enabling details adds `video-details`, `creator-details`, or `creator-videos` per attached row or nested upload.

### Related datasets from Data Scrapers

- **Red Note Scraper** — Red Note (Xiaohongshu) posts and creator profiles; the closest Chinese social-video analogue for cross-platform trend research.
- **TikTok Creator Stats** — TikTok creator and video engagement data for short-video creator benchmarking.
- **YouTube Channel Scraper** — YouTube channel and video records for long-form content analytics.
- **Instagram Post Scraper** — Instagram post and engagement data for social content monitoring.
- **Twitter X Profile Scraper** — X/Twitter profile data for creator and audience research.

### Data Scrapers support

Need an additional field, record type, or export workflow? Contact Data Scrapers at stardustspotlight@gmail.com. Include a sample source URL, the required fields, the expected record volume, and your preferred delivery format.

# Actor input Schema

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

Bilibili page URLs to scrape, e.g. "https://www.bilibili.com/video/BV1Kthg69E9K/", "https://space.bilibili.com/390949212", "https://www.bilibili.com/movie/", or "https://search.bilibili.com/all?keyword=原神".

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

Keywords to search on Bilibili, e.g. "原神", "LOL", or "美食". Each query is paginated until maxItems is reached.

## `categories` (type: `array`):

Built-in Bilibili sections to scrape. Use this instead of (or together with) category URLs.

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

Maximum number of primary videos from search, URLs, or categories (0 = unlimited). Nested creator videos do not count toward this limit.

## `scrapeVideoDetails` (type: `boolean`):

When enabled, attach a videoDetails object on each primary row (description, tags, coins, favorites, shares). Charged as the video-details event per record. Default is disabled.

## `scrapeCreatorVideos` (type: `boolean`):

When enabled, attach a creatorVideos list on each primary row with that creator's uploads (10 by default; set maxCreatorVideos to 0 for all). Extra uploads do not become new dataset rows. Charged as the creator-videos event per extra upload. Creator space URLs already scrape uploads as primary rows, so this list is not duplicated onto those rows. Default is disabled.

## `maxCreatorVideos` (type: `integer`):

How many uploads to attach in creatorVideos for each creator. Default is 10. Set to 0 to extract all of that creator's videos.

## `scrapeCreatorStats` (type: `boolean`):

When enabled, attach a creatorDetails object on each primary row (followers, following, video count, level, bio). Charged as the creator-details event per record. Default is disabled.

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

Proxy settings. Residential proxies are recommended for Bilibili.

## Actor input object example

```json
{
  "searchQueries": [
    "原神"
  ],
  "categories": [
    "popular"
  ],
  "maxItems": 20,
  "scrapeVideoDetails": false,
  "scrapeCreatorVideos": false,
  "maxCreatorVideos": 10,
  "scrapeCreatorStats": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

JSON array of scraped Bilibili records

## `runStats` (type: `string`):

Aggregate scrape stats for this run

## `run` (type: `string`):

Apify Console link to inspect 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 = {
    "searchQueries": [
        "原神"
    ],
    "categories": [
        "popular"
    ],
    "maxItems": 20,
    "maxCreatorVideos": 10,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("datascrapers/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": ["原神"],
    "categories": ["popular"],
    "maxItems": 20,
    "maxCreatorVideos": 10,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("datascrapers/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": [
    "原神"
  ],
  "categories": [
    "popular"
  ],
  "maxItems": 20,
  "maxCreatorVideos": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call datascrapers/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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