# Bilibili Scraper: Videos, Creators, Comments & Danmaku (`senshiesr/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩) videos by keyword, URL, creator (UP主) or trending list. Full stats, tags, creator followers, comments and danmaku with timestamps. Clean English fields, monitoring mode, no login needed.

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

## Pricing

from $4.00 / 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.

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, Creators, Comments & Danmaku

Scrape **Bilibili (哔哩哔哩, B站)**, China's largest video platform, into clean, structured data with **English field names**. Search by keyword, scrape any video, follow creators (UP主) or grab the trending lists, and get full stats, tags, creator follower counts, comments and **danmaku (弹幕) with the exact second each one appears**.

No Bilibili account needed. Pay only for what you get.

### What you can scrape

| Input | Example | What you get |
|---|---|---|
| **Keyword search** | `原神`, `minecraft`, `cooking` | Up to 1,000 videos per keyword, sorted by relevance, views, newest, danmaku or favorites; filter by video length |
| **Video URLs** | `https://www.bilibili.com/video/BV1KiJk67EQ9`, `b23.tv/...`, `BV...`, `av...` | That video's full data |
| **Creators (UP主)** | `https://space.bilibili.com/431956189` | The creator's uploads, newest first |
| **Trending** | Popular now / Top 100 ranking | What's hot on Bilibili right now |

Every video comes with:

- **Stats:** views, likes, coins, favorites, shares, danmaku count, comment count
- **Details:** title, description, cover image, publish time, duration, category (分区), tags, number of parts, original vs. repost
- **Creator:** name, channel URL, avatar, **follower count**, bio, level
- **Danmaku (optional):** text, playback second, send time, color and position. Great for finding the most-reacted moments in a video.
- **Comments (optional):** text, likes, reply count, author and top replies

### Why this scraper

- **Clean English output.** Consistent field names, real numbers, ISO dates and durations in seconds, so it's ready for spreadsheets, BI tools and AI pipelines.
- **Danmaku with timestamps.** See exactly what viewers react to, and when.
- **Monitoring mode.** Schedule it daily on keywords, creators or trending lists and get only new videos (you're charged only for new ones).
- **Handles Bilibili's anti-bot checks automatically**: visitor cookies, request signing (WBI) and automatic recovery. Optional proxy support if you need it.
- **Fair pricing.** Pay per video, plus small per-item fees for comments and danmaku only if you ask for them. Set a maximum cost per run and the scraper stops cleanly at it.

### Input example

```json
{
    "searchQueries": ["原神", "minecraft"],
    "searchSort": "newest",
    "maxVideosPerSearch": 100,
    "creatorUrls": ["https://space.bilibili.com/431956189"],
    "trending": "ranking",
    "publishedWithinDays": 7,
    "includeDanmaku": true,
    "maxDanmakuPerVideo": 1000,
    "includeComments": false
}
```

### Output example

A real record (description shortened):

```json
{
    "bvid": "BV1KiJk67EQ9",
    "aid": 117443632567747,
    "url": "https://www.bilibili.com/video/BV1KiJk67EQ9",
    "title": "我造了一块会飞的滑板...",
    "description": "这次手搓的是一个操控难度有点高，但是超级灵活的个人飞行器—载人飞行滑板！…",
    "coverUrl": "https://i1.hdslb.com/bfs/archive/72619f16a4b0703a5aa22c1c0bbcc5b9735f9799.jpg",
    "publishedAt": "2026-10-15T09:30:00.000Z",
    "durationSeconds": 598,
    "category": "极客DIY",
    "categoryId": 2104,
    "tags": ["DIY", "梦想", "阶跃星辰", "阶跃终端"],
    "partsCount": 1,
    "isOriginal": true,
    "stats": { "views": 5001935, "likes": 240390, "coins": 106203, "favorites": 81701, "shares": 33300, "danmaku": 6876, "comments": 10238 },
    "creator": {
        "mid": 431956189,
        "name": "神奇阿宇Ayu",
        "url": "https://space.bilibili.com/431956189",
        "avatarUrl": "https://i1.hdslb.com/bfs/face/adce71d5e42b828d50b9f8625c3bded666468b46.jpg",
        "followers": 1122901,
        "bio": "相信自己",
        "level": 6
    },
    "comments": null,
    "danmaku": [
        { "text": "天才威", "timeSeconds": 0, "sentAt": "2026-10-16T01:44:36.000Z", "color": "#00a0ea", "mode": 5, "id": "2223181408041270528" },
        { "text": "麻烦加一下AI标签，谢谢！", "timeSeconds": 0.456, "sentAt": "2026-10-16T09:27:33.000Z", "color": "#ffffff", "mode": 1, "id": "2223414417759583488" }
    ],
    "source": { "type": "video", "value": "https://www.bilibili.com/video/BV1KiJk67EQ9" },
    "scrapedAt": "2026-10-17T09:54:23.362Z"
}
```

Download results as JSON, CSV, Excel or HTML, or use the API. A run summary (`SUMMARY` in the key-value store) shows every input with how many videos were found and output, and why any failed (e.g. a deleted video).

### Good to know

- **Comments:** Bilibili shows only a few comments (usually 3 plus their replies) to visitors who aren't logged in, and that's what the scraper returns by default. If you need more, add your own Bilibili login cookie in the *Advanced* section (see FAQ).
- **Danmaku:** you get the danmaku Bilibili shows to viewers, typically 1,000+ per video spread across its whole length. The `stats.danmaku` count is Bilibili's all-time total, which includes older danmaku that Bilibili no longer shows.
- **Multi-part videos (分P):** stats cover the whole video; duration and danmaku are for the first part.

### Monitoring new videos

1. Turn on **Only new videos since the last run**.
2. Save as a task and add a **schedule** (e.g. every 6 hours).
3. Connect an integration (Slack, email, Google Sheets, Zapier, Make, webhook) to get new videos as they appear.

Use a different **Monitoring name** for each separate setup to keep their histories apart.

### Use cases

- **Brand & market research in China:** track what's said about your brand, product or game.
- **Influencer marketing:** find creators by topic, compare followers and engagement.
- **Gaming & anime industry:** track launches, trailers and community reactions (danmaku shows the exact moments people react to).
- **Trend tracking:** watch the popular and top-100 lists over time.
- **AI & research datasets:** Chinese-language video metadata, comments and danmaku.

### FAQ

**Do I need a Bilibili account?** No. Everything works without logging in. A login cookie is only useful for getting more than a few comments per video.

**How do I add a login cookie?** Log in to bilibili.com in your browser, open the developer tools (F12) → Application → Cookies → `https://www.bilibili.com`, copy the value of `SESSDATA`, and paste it as `SESSDATA=<value>`. It's stored encrypted. Use an account you're comfortable using for automation.

**Do I need a proxy?** Usually not. If Bilibili starts blocking runs (you'll see a clear message in the log), enable Apify Proxy in the *Advanced* section. Residential proxies work best.

**Is it legal?** The scraper collects publicly visible video information and doesn't log in unless you provide your own cookie. Make sure your use of the data complies with applicable laws and Bilibili's terms, especially for personal data such as commenter names.

**Found a bug or need a field?** Open an issue in the Issues tab.

### More from the same developer

- **[Career Site Jobs Scraper](https://apify.com/senshiesr/career-site-jobs-scraper)**: every open job from company career pages on Greenhouse, Lever, Ashby, Workday, SmartRecruiters, Workable and Recruitee, with a monitor mode for new jobs.
- **[Google Hotels Scraper](https://apify.com/senshiesr/google-hotels-scraper)**: hotel prices for any city and dates, prices from every booking site, room offers, ratings and reviews.

# Actor input Schema

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

Find videos by keyword, like the search box on bilibili.com. Chinese or English keywords both work.

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

Video links (bilibili.com/video/BV..., m.bilibili.com, b23.tv short links) or plain BV / av ids.

## `creatorUrls` (type: `array`):

Get a creator's uploads, newest first. Use their channel URL (space.bilibili.com/123456) or numeric id.

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

Also scrape a trending list: Popular (bilibili.com/v/popular, refreshed through the day) or Ranking (the daily top 100).

## `maxTrendingVideos` (type: `integer`):

How many trending videos to scrape.

## `searchSort` (type: `string`):

How search results are ordered.

## `searchDuration` (type: `string`):

Only return search results of this length.

## `maxVideosPerSearch` (type: `integer`):

Bilibili returns at most 1,000 results per keyword.

## `maxVideosPerCreator` (type: `integer`):

Newest uploads first.

## `publishedWithinDays` (type: `integer`):

Only output videos published in the last N days (does not apply to video URLs you enter directly).

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

Adds comments (hot comments first) with their top replies to each video. Without a Bilibili login cookie, Bilibili only shows a few comments per video, so only those can be returned.

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

Hot comments first. Without a login cookie Bilibili usually shows about 3.

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

Adds the danmaku (on-screen comments) Bilibili shows viewers, with the exact second each one appears, its color and send time. Typically 1,000+ per video, spread across the whole video.

## `maxDanmakuPerVideo` (type: `integer`):

0 = every danmaku Bilibili returns.

## `onlyNewVideos` (type: `boolean`):

For scheduled monitoring of keywords, creators or trending lists: outputs (and charges for) only videos not delivered in earlier runs. The first run outputs everything.

## `monitoringName` (type: `string`):

Use a different name for each separate monitoring setup so they keep separate history.

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

Usually not needed. If Bilibili starts blocking runs, enable Apify Proxy (residential works best).

## `bilibiliCookie` (type: `string`):

Only needed for more than a few comments per video. Paste the SESSDATA cookie from a logged-in browser as SESSDATA=.... Use an account you don't mind using for automation; it is used only to read public pages.

## Actor input object example

```json
{
  "searchQueries": [
    "minecraft"
  ],
  "trending": "none",
  "maxTrendingVideos": 50,
  "searchSort": "relevance",
  "searchDuration": "any",
  "maxVideosPerSearch": 50,
  "maxVideosPerCreator": 30,
  "includeComments": false,
  "maxCommentsPerVideo": 20,
  "includeDanmaku": false,
  "maxDanmakuPerVideo": 1000,
  "onlyNewVideos": false,
  "monitoringName": "default",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

All videos output by this run, as a table.

## `videosFull` (type: `string`):

The same videos with every field.

## `summary` (type: `string`):

One entry per input (keyword, video URL, creator, trending list): status, videos found and videos output.

# 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": [
        "minecraft"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("senshiesr/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": ["minecraft"],
    "proxyConfiguration": { "useApifyProxy": False },
}

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

```

## MCP server setup

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