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

Bilibili Scraper SD - Bilibili Scraper is a social media data tool that extracts public Bilibili (哔哩哔哩) videos from search, video details, full comment threads, creator videos and profiles, popular and zone rankings and hot searches, with views, likes, coins, danmaku and tags. No login.

- **URL**: https://apify.com/neuro-scraper/bilibili-scraper.md
- **Developed by:** [Neuro Scraper](https://apify.com/neuro-scraper) (community)
- **Categories:** Social media, Videos, Developer tools
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

./README.md

# Actor input Schema

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

What to scrape. Search uses 'Search keywords'; video details and video comments use 'Video URLs or BV ids'; user videos and user profiles use 'User IDs or space URLs'; popular uses 'Category'; hot searches needs no input.

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

Mode 'search': one keyword per line, Chinese or English (e.g. 原神, 人工智能教程, python). Bilibili returns up to 50 pages of 20 videos (about 1,000) per keyword; the Actor follows the pages until Max items.

## `sortOrder` (type: `string`):

Mode 'search': Bilibili's own sort order (sent to the search, as on search.bilibili.com).

## `durationFilter` (type: `string`):

Mode 'search': Bilibili's own length filter.

## `pubtimeBegin` (type: `string`):

Only videos published on or after this date (YYYY-MM-DD, China time). In 'search' it is sent to Bilibili's search (both bounds are always sent - the missing one becomes 2009-06-26 / today); in the other video lists it is applied by the Actor.

## `pubtimeEnd` (type: `string`):

Only videos published on or before this date (YYYY-MM-DD, China time). Same handling as 'Published on/after'.

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

Modes 'video_detail' and 'video_comments': one per line - a video link (https://www.bilibili.com/video/BV1DRHU6LELy), a BV id (BV1DRHU6LELy), an av id (av117403820230630) or a b23.tv short link.

## `userIds` (type: `array`):

Modes 'user_videos' and 'user_profile': one per line - a numeric user id (mid, e.g. 178778949) or a space link (https://space.bilibili.com/178778949). 'user_videos' gives one profile row and then the creator's uploads, newest first, page by page (30 per page) until Max items.

## `category` (type: `string`):

Mode 'popular': 'All' = the 综合热门 popular list (paged, 20 per page). A category = that zone's ranking list (排行榜, up to 100 videos). Zone ids are read from Bilibili's own site menu on every run.

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

Stops after this many rows in total (videos, comments, profiles). Every list follows Bilibili's own next page / cursor until this number or the end of the list. 'maxResults' is accepted as the same setting.

## `includeComments` (type: `boolean`):

Adds comment rows (type 'comment') after each video row in search, video details, user videos and popular.

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

Top-level comments per video, 20 per page following Bilibili's comment cursor (also used by mode 'video_comments').

## `sortComments` (type: `string`):

Order of the top-level comments (Bilibili's own sort).

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

Adds the replies of every top-level comment (楼中楼) as rows with rootCommentId set, 20 per page.

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

Replies per top-level comment when 'Expand comment threads' is on.

## `fetchDetails` (type: `boolean`):

One extra request (plus one for tags) per video in search, user videos and popular, to fill coins, shares, tags, cid and all counters. Search rows already carry views, likes, favorites, danmaku and comments; user-video rows carry views only.

## `includeDanmaku` (type: `boolean`):

Reads each video's public danmaku (弹幕) pool (1,200 per video on 2026-10-09; on long videos it can cover only part of the timeline) and adds: danmaku fetched, unique senders, danmaku per minute of the covered span, peak minute, first/last time and a text sample.

## `danmakuSampleSize` (type: `integer`):

How many danmaku texts (spread over the video timeline) go into danmakuSample.

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

Residential proxies (the default) are recommended. Bilibili answered from a home connection in Bangladesh and from residential IPs in the US and Hong Kong (measured 2026-10-09).

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "原神"
  ],
  "sortOrder": "totalrank",
  "durationFilter": "any",
  "videoUrls": [
    "https://www.bilibili.com/video/BV1DRHU6LELy"
  ],
  "userIds": [
    "178778949"
  ],
  "category": "all",
  "maxItems": 40,
  "includeComments": false,
  "maxCommentsPerVideo": 20,
  "sortComments": "hot",
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "fetchDetails": false,
  "includeDanmaku": false,
  "danmakuSampleSize": 25,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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": [
        "原神"
    ],
    "videoUrls": [
        "https://www.bilibili.com/video/BV1DRHU6LELy"
    ],
    "userIds": [
        "178778949"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("neuro-scraper/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": ["原神"],
    "videoUrls": ["https://www.bilibili.com/video/BV1DRHU6LELy"],
    "userIds": ["178778949"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

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

```

## MCP server setup

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