# Bilibili Scraper: Videos, Comments and Uploaders (`oski/bilibili-scraper`) Actor

Scrape Bilibili videos by keyword, link, popular feed or ranking list. Get title, views, likes, coins, favourites, danmaku, duration, tags, uploader and publish date, plus top comments with replies and uploader profiles. No login. Pay per video, comment and uploader.

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

## Pricing

from $9.70 / 1,000 videos

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 (Videos, Comments, Uploaders)

Video data from Bilibili by keyword, video link, popular list or ranking: title, description, tags, category, duration, publish date, uploader and every public stat (views, likes, coins, favourites, shares, danmaku, comments). Add top comments with their replies, and uploader profiles with fan, video and like counts. Pay per video, comment and uploader delivered. No login, no browser, no API key.

This one speaks the site's own signed API (the same calls the web app makes), rotates its identity before Bilibili's risk control bites, retries comments on a residential IP when Bilibili hands a datacenter an empty list (with the fallback on), and ends every run with a status line that says what came back and why anything is missing.

### What you get

**Video rows** (`type: video`): `bvid`, `aid`, `title`, `description`, `url`, `cover`, `duration_seconds`, `published_at`, `category`, `tags` (keyword searches only; Bilibili's detail and list answers carry no tags), `uploader_mid`, `uploader_name`, `uploader_url`, `views`, `likes`, `coins`, `favourites`, `shares`, `danmaku`, `comments` (the full count), `rank` (for lists), `source`.

**Comment rows** (`type: comment`): `rpid`, `bvid`, `aid`, `text`, `author`, `author_mid`, `likes`, `reply_count`, `created_at`, nested `replies`.

**Uploader rows** (`type: uploader`): `mid`, `name`, `url`, `face`, `sign`, `fans`, `following`, `videos`, `likes`, `level`, `official_title`.

### Use cases

- **Trend research:** what is popular on Chinese video right now, by category.
- **Keyword monitoring:** the videos Bilibili ranks for a product, game or topic (relevance order), with engagement counts.
- **Creator analysis:** an uploader's profile and public stats; their videos via a name search.
- **Audience research:** top comments and replies, with likes, for sentiment work.
- **Datasets:** titles, tags and stats for recommendation or NLP projects.

### How to use it

1. Type keywords, paste video links or BV ids, add uploader ids, or turn on the popular or ranking list.
2. Choose how many videos per source and whether to include comments.
3. Start the run. Download as JSON, CSV or Excel, or read the dataset through the API.

### What each source gives

| Source | Per request | How far | Notes |
|---|---|---|---|
| Keyword search | 20 videos | up to 1,000 (50 pages) | Bilibili matches loosely and never answers "0 results"; the status line shows how many came back |
| Video link or id | the full record | | a removed or restricted video costs nothing and the status line says why |
| Popular list | 20 a page | up to 400 (20 pages) | |
| Ranking | 100 | | by category |
| Uploader id | the profile | | the uploader's own video list needs a browser-grade signature Bilibili does not hand out; search the name instead |
| Comments | the 3 top comments, then up to 20 replies under each | about 63 per video at most | Bilibili shows that much to visitors without a login; the full count is on the video row. Retried on residential (fallback on) when a datacenter IP gets an empty list |

### Cost

| Delivered | Cost |
|---|---|
| 100 videos | about $1.00 |
| 1,000 videos | about $10 |
| 1,000 comments | about $2.00 |
| 100 uploaders | about $1.00 |

A small fee per run plus a fee per video, per comment and per uploader (the table assumes $0.01, $0.002 and $0.01). A video found by two of your sources is charged once, and so are its comments. Removed or restricted videos, refused requests and empty searches are free.

### Scheduling and API

```bash
curl -X POST "https://api.apify.com/v2/acts/oski~bilibili-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"keywords": ["原神"], "maxVideos": 100, "includeComments": true, "maxCommentsPerVideo": 20}'
```

### If something looks wrong

| Status line says | What it means | What to do |
|---|---|---|
| Input problem: Add at least one Bilibili video link ... | Nothing usable in the inputs | Add a keyword, a BV id or an uploader id |
| Skipped '...': not a Bilibili video link | A line was not Bilibili | Remove it |
| The video does not exist or was removed | Bilibili answered -404 | Nothing to do; the row is free |
| Bilibili restricts this video | Region, age or membership gate | Nothing to do; the row is free |
| Bilibili refused every identity and proxy we tried | Risk control on both pools | Run again later |
| Uploader video lists are not available yet | Bilibili's space listing needs a browser signature | Search the uploader's name as a keyword |
| "python" stopped at your maximum of 200 videos (1,000 listed) | Your cap | Raise Videos per source |
| Bilibili shows visitors without a login only the 3 top comments ... | Bilibili's visitor view | Nothing to do; the comments column on the video row has the full count |
| "python": Bilibili refused the later pages; 340 videos were kept | Risk control part way | Run again later for the rest |

### Frequently asked questions

**Is the text in Chinese?** Titles, descriptions, tags and comments are whatever the uploader wrote, mostly Chinese. Category names are Bilibili's Chinese names.

**Can I get a whole channel?** Not yet: the uploader video list endpoint refuses non-browser clients. A keyword search for the uploader's name gets most of their recent videos.

**Why only a few comments per video?** Bilibili shows visitors without a login the 3 top comments and the first 20 replies under each. Logging in is not something this actor does.

**Does it download videos?** No. It reads public metadata, stats and comments only.

### Related actors by the same developer

- YouTube Transcript Scraper
- TikTok Transcript Scraper
- Telegram Channel Scraper

# Actor input Schema

## `keywords` (type: `array`):

Searches on bilibili.com, one per line, in any language. Each returns up to 1,000 videos (50 pages of 20).

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

Full video links, BV or av ids, or b23.tv short links, one per line. Each gives the full video record (stats, uploader, description).

## `uploaderIds` (type: `array`):

Numeric mids or space.bilibili.com links. Gives the uploader profile (fans, videos, likes, level). Their video list is not available yet; search their name as a keyword instead.

## `includePopular` (type: `boolean`):

Adds Bilibili's current popular videos (up to the maximum below).

## `includeRanking` (type: `boolean`):

Adds the current top 100 ranking.

## `rankingCategory` (type: `string`):

Which ranking to read when the ranking list is on.

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

Cap per keyword or list. A keyword gives up to 1,000 (50 pages), the popular feed up to 400, the ranking 100. The status line says when a list stopped at this cap.

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

Adds comments for every video delivered, charged per comment. Bilibili shows visitors without a login the 3 top comments of a video plus the first 20 replies under each; the video row's comments column carries the full count.

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

Comments (top comments plus their replies) per video when comments are on. Bilibili's visitor view caps this at about 63.

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

Apify datacenter proxy is enough for videos and search. When Bilibili answers a datacenter IP's comment request with an empty list, the request is retried on residential if the fallback below is on.

## `residentialFallback` (type: `boolean`):

Retry a refused request on a residential IP. Turn off to never use residential proxy.

## `concurrency` (type: `integer`):

How many sources run in parallel.

## Actor input object example

```json
{
  "keywords": [
    "原神",
    "vlog",
    "咖啡"
  ],
  "videoUrls": [
    "https://www.bilibili.com/video/BV1xx411c7mD",
    "BV1xx411c7mD",
    "av170001",
    "https://b23.tv/abc123"
  ],
  "uploaderIds": [
    "946974",
    "https://space.bilibili.com/946974"
  ],
  "includePopular": false,
  "includeRanking": false,
  "rankingCategory": "0",
  "maxVideos": 100,
  "includeComments": false,
  "maxCommentsPerVideo": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": true,
  "concurrency": 3
}
```

# Actor output Schema

## `overview` (type: `string`):

Video, comment and uploader rows: title, uploader, views, likes, comments, published date, rank, comment text, fans and link.

## `allFields` (type: `string`):

Every field for each row, including coins, favourites, danmaku, duration, tags, description, reply details and uploader profile stats.

# 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 = {
    "keywords": [
        "python"
    ],
    "maxVideos": 100
};

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

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

```

## MCP server setup

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