# Bilibili Scraper - Videos, Search, Creators, Ranking & Comments (`thony-data/bilibili-scraper`) Actor

Low-cost Bilibili (B站) scraper: just $2 per 1,000 videos, no login. Keyword search, video URLs, creator (UP主) videos, Popular and Ranking lists, with views, likes, coins, favorites, shares, danmaku, tags and top comments.

- **URL**: https://apify.com/thony-data/bilibili-scraper.md
- **Developed by:** [THONY AN](https://apify.com/thony-data) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.60 / 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 (B站)

Scrape **Bilibili videos** without login: keyword search, specific videos, creators (UP主), the Popular list and the site-wide Ranking — with full engagement stats and optional top comments.

### What you get

For every video: title, description, cover, duration, publish time, category, creator name / ID / link, **views, likes, coins, favorites, shares, danmaku, comments**, tags, honors (e.g. 全站排行榜最高第1名), publisher IP location, and where it came from (search rank, trending rank).

Optional **comments**: text, likes, reply count, time, IP location (IP属地), user level, pictures, pinned flag.

### Why this scraper

- **No login, no cookies, no account risk.**
- **5 sources in one Actor**: search, video URLs, creators, Popular (热门), Ranking (排行榜).
- **Search sort orders**: best match, most views, newest, most danmaku, most favorites.
- **Full stats on demand**: turn on *Fetch full details* to add likes, coins, shares and tags to search and creator results.
- **Clean output**: highlight tags removed from titles, HTTPS image URLs, ISO dates, durations in seconds.
- **Reliable**: handles Bilibili's request signing and risk control automatically, and routes search through Asian residential IPs so it doesn't come back empty.
- **Fair pricing**: pay per video and per comment — a fraction of other Bilibili scrapers.

### Input examples

Search, newest first:

```json
{ "searchKeywords": ["原神", "AI 绘画"], "searchOrder": "pubdate", "maxResultsPerSource": 200 }
```

A creator's latest videos with full stats:

```json
{ "userIds": ["https://space.bilibili.com/12098841"], "fetchVideoDetails": true, "maxResultsPerSource": 50 }
```

Today's ranking with top comments:

```json
{ "trending": "ranking", "includeComments": true, "maxResultsPerSource": 100 }
```

### Output (video)

```json
{
  "type": "video",
  "bvid": "BV1atse6EEfx",
  "url": "https://www.bilibili.com/video/BV1atse6EEfx",
  "title": "当我用AI续写爱情公寓4关谷悠悠婚礼【AI全民制作人】",
  "durationSeconds": 1266,
  "publishedAt": "2026-11-20T10:00:00+00:00",
  "authorName": "Nero_闪灵",
  "authorId": 12098841,
  "views": 3208609,
  "likes": 335408,
  "coins": 293565,
  "favorites": 150372,
  "shares": 74420,
  "danmaku": 8130,
  "comments": 15719,
  "tags": ["爱情公寓", "搞笑"],
  "honors": ["全站排行榜最高第1名", "热门收录"],
  "source": "video"
}
```

### Limits

- Bilibili shows at most **1,000 search results** per keyword.
- Logged-out visitors can only see the **first page of comments** (about 20 top + 20 newest per video). This Actor never logs in, so it returns those.
- Search and creator lists don't include likes, coins, shares or tags unless *Fetch full details* is on.

### Use cases

- Market and trend research on the Chinese video market
- Creator (KOL / UP主) discovery and benchmarking
- Brand and product mention monitoring
- Building datasets for sentiment analysis or LLMs

# Actor input Schema

## `searchKeywords` (type: `array`):

Search Bilibili videos by keyword (Chinese or English). Bilibili returns at most 1,000 results per keyword.

## `searchOrder` (type: `string`):

How search results are sorted.

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

Bilibili video links or IDs (BV1atse6EEfx, av170001). Returns full stats and tags.

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

Creator space URLs (https://space.bilibili.com/12098841) or numeric user IDs. Returns their videos, newest first.

## `trending` (type: `string`):

Optionally include Bilibili's Popular (热门) list or the site-wide Ranking (排行榜, top 100).

## `maxResultsPerSource` (type: `integer`):

Stop after this many videos for each search keyword, each creator and the trending list.

## `fetchVideoDetails` (type: `boolean`):

Search and creator lists don't include likes, coins, shares and tags. Turn this on to fetch them for every video (slower).

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

Add each video's pinned, top and newest comments (up to about 40 per video; Bilibili limits what logged-out visitors can see). Comments are charged separately.

## `includeCommenterNames` (type: `boolean`):

Off by default for privacy. Turn on to add each commenter's public nickname and user ID.

## Actor input object example

```json
{
  "searchKeywords": [
    "原神"
  ],
  "searchOrder": "totalrank",
  "videoUrls": [
    "https://www.bilibili.com/video/BV1atse6EEfx"
  ],
  "trending": "none",
  "maxResultsPerSource": 20,
  "fetchVideoDetails": false,
  "includeComments": false,
  "includeCommenterNames": false
}
```

# Actor output Schema

## `videos` (type: `string`):

All scraped videos and comments. Filter by the type field (video / comment).

# 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 = {
    "searchKeywords": [
        "原神"
    ],
    "videoUrls": [
        "https://www.bilibili.com/video/BV1atse6EEfx"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("thony-data/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 = {
    "searchKeywords": ["原神"],
    "videoUrls": ["https://www.bilibili.com/video/BV1atse6EEfx"],
}

# Run the Actor and wait for it to finish
run = client.actor("thony-data/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 '{
  "searchKeywords": [
    "原神"
  ],
  "videoUrls": [
    "https://www.bilibili.com/video/BV1atse6EEfx"
  ]
}' |
apify call thony-data/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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