# Bilibili Scraper - Videos, Danmaku, Comments & Translation (`ntriqpro/bilibili-video-danmaku-scraper`) Actor

Bilibili scraper (哔哩哔哩, B站) with no login: keyword search, video stats and tags, creator channels, related videos and every stored danmaku (bullet comment) as its own row with a reaction profile. Paid plans add English translation and AI summaries of what viewers said.

- **URL**: https://apify.com/ntriqpro/bilibili-video-danmaku-scraper.md
- **Developed by:** [Daniel Carter](https://apify.com/ntriqpro) (community)
- **Categories:** Social media, AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.26 / 1,000 danmakus

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

Bilibili scraper (哔哩哔哩, B站) that works without login: keyword search, video stats and tags, creator channels, related videos — and **every stored danmaku (bullet comment) as its own row**, with a counted reaction profile per video. Paid plans can add English translation and AI summaries of what viewers said.

| | Free plan (preview) | Paid Apify plan (Starter and up) |
|---|---|---|
| Targets per run (keywords, channels and videos together) | 2 | 200 |
| Videos per keyword | the first 5 of the first page (Bilibili's default order) | up to 1,000 per search, more through date windows (`maxVideosPerSource`) |
| Videos per channel | the 5 newest | the whole video list |
| Danmaku rows per video | 20, spread over the video — the same 20 on every run; a smaller `maxDanmakuPerVideo` returns the first lines of those same 20 (the sample can change when the video's danmaku pool changes) | every danmaku Bilibili stores for the video (100 to 6,000 by video length, returned up to 1.2× that); `maxDanmakuPerVideo` sets your limit, default 500 |
| Reaction profile row | how many danmaku were read and stored, the 3 most repeated phrases + how much more is locked (senders, per-minute rate, peaks and times are `null`) | everything: per-minute timeline, 5 peaks with sample lines, 20 phrases, reaction kinds |
| Comments | 1 per video (first 140 characters) + the total count | as many as Bilibili shows without login (usually the top 3 with the replies under them) + the total count |
| Related videos (`include: related`) | 3 + how many more | up to 40 per video |
| Metrics you would poll (views, likes, coins, favorites, shares, comment counts; channel followers, average and median views, top videos; keyword totals; related-video counts) | `null` with `metricsLocked: true` — titles, links, dates, the danmaku count and samples stay | all values |
| Description and comment text | first 140 characters (`textTruncated: true`) | full |
| Search order, date range, more than 5 videos (`sortOrder`, `since`, `until`, `maxVideosPerSource`) | locked | yes |
| AI layers (danmaku translation, title/description/comment translation, reaction summary per video, keyword insight) | not available — a free run calls no model; it tells you how many lines would have been translated | every layer you switch on, up to `aiMaxItems` per run |
| Limits report (`limits` row and notice rows) | complete | complete |
| Price per event | list price | collection rows: BRONZE −20%, SILVER −35%, GOLD and up −48%; AI events: the same price on every plan |

**How big is the difference?** Measured on 2026-10-08: a free run of the keyword `原神` returned 5 videos and 41 danmaku; the same 5 videos held 557. In our sample runs the first 5 videos of a keyword held 528 (`原神`), 1,286 (`特斯拉`), 2,817 (`护肤`) and 4,107 (`泡泡玛特`) danmaku — a free run shows 20 per video. One video of the `泡泡玛特` search held 3,600 stored danmaku (11,851 sent); a free run shows 20 of them.

**What the locked part would cost.** Each `free-plan-preview` row carries `paidQuote`: the danmaku that stayed locked in the videos this run read (`lockedDanmakuRows`, counted), priced per plan tier (`lockedDanmakuUsd`: Free, Bronze, Silver, Gold and up) — danmaku rows only; the video lookup, reaction profile, comments and AI layers are charged on top. For a keyword or channel it also carries `estimatedWholeSource`, an estimate (average danmaku per video read × the videos Bilibili reports, at most 1,000 per search, before any `maxDanmakuPerVideo` limit) that is labelled as an estimate and is not a count. Note that the Console form is pre-filled with 5 videos and 100 danmaku per video, while the API defaults are 20 videos and 500 danmaku.

A free run never fails because of a limit: it shows the preview, tells you in the dataset what stayed locked as counted numbers (`free-plan-preview` rows: `41 of the 557 danmaku those videos hold`), and ignores paid-only inputs with a notice instead of an error.

> **Unofficial.** This Actor is **not affiliated with, endorsed by, or sponsored by** Bilibili. It reads **public** pages only, without login. You are responsible for how you use the input and the results, for complying with Bilibili's terms, and with GDPR, PIPL, PIPA, CCPA and other applicable laws.

### Why use this Bilibili scraper?

- **Danmaku as rows, not a sample.** Each bullet comment is one row: text, the second of the video it was posted at, when it was sent, mode, colour. Sort by `videoTimeSeconds` and you can read the audience's reaction scene by scene.
- **A reaction profile per video, counted — no language model.** Danmaku per minute, the 5 busiest minutes with sample lines, the 20 most repeated phrases, share of distinct texts, distinct senders, and reaction kinds (laughter, awe, moved, question, complaint, cheer, warning) with the words that matched.
- **For people who do not read Chinese.** Optional AI layers translate danmaku, titles, descriptions and comments, and write a short summary of what viewers reacted to — each citing the danmaku it is based on.
- **Search that goes where you point it.** Sort by views, date, danmaku or favorites; set a date range; ask for more than 1,000 videos and the run splits the search into date windows.
- **Honest about limits.** A `limits` row says what Bilibili allowed: the 1,000-result cap, the stored-danmaku pool per video, how many comments it showed without login, how many answers were refused and retried.

**Tip: use Chinese keywords.** Bilibili is searched in Chinese: `特斯拉` finds far more than `Tesla`, `泡泡玛特` more than `Pop Mart`, `苹果手机` more than `iPhone`. Brand names in Latin letters that Chinese viewers type as they are (`iPhone 17`, `GTA6`) work too.

### How to use it

1. Enter one or more **keywords** (Chinese works best), **videos** (BV number, av number or address) or **channels** (mid or space address).
2. Choose the row kinds (`include`) and the limits (`maxVideosPerSource`, `maxDanmakuPerVideo`).
3. Optionally switch on AI layers (`ai`) on a paid plan.
4. Run it and read the dataset; the last rows tell you what was limited and why.

### Input

| Field | Type | Description |
|---|---|---|
| `keywords` | array | Video searches. Chinese keywords find the most |
| `videos` | array | BV number, `av` number or bilibili.com video address (only the id is taken from an address; `b23.tv` short links are not accepted) |
| `channels` | array | mid or space.bilibili.com address |
| `includeTrending` | boolean | Also read Bilibili's popular list as video rows (`discoveredVia: trending`) |
| `include` | array | `videos`, `details`, `danmaku`, `danmakuProfile`, `comments`, `related`. When omitted: all but `related` |
| `maxVideosPerSource` | integer | Videos per keyword, per channel and from the popular list, 1–20,000 (default 20; above 5: paid plans) |
| `maxDanmakuPerVideo` | integer | Danmaku rows per video, spread over the video; default 500, `0` = all stored (above 20: paid plans) |
| `sortOrder` | string | `relevance`, `views`, `newest`, `danmaku`, `favorites` (paid plans) |
| `since` / `until` | date | Publication date range for keyword searches (paid plans) |
| `ai` | array | AI layers to switch on: `danmakuTranslation`, `translation`, `videoSummary`, `keywordInsight` (paid plans, off by default) |
| `aiLanguage` | string | Language code of translations and summaries (default `en`) |
| `aiMaxItems` | integer | The most texts one run sends to the model (default 5,000) |
| `proxyConfiguration` | object | Apify Proxy; keep it on |

```json
{
  "keywords": ["特斯拉"],
  "maxVideosPerSource": 20,
  "maxDanmakuPerVideo": 500,
  "include": ["videos", "details", "danmaku", "danmakuProfile", "comments"]
}
```

**What the danmaku limit costs.** The run's log and first status message say it before anything is read: `Up to 500 danmaku rows per video: at most $0.25 per video for danmaku at the Free-tier price`. Lower `maxDanmakuPerVideo` to spend less, set `0` to get everything Bilibili stores. The reaction profile is counted from all stored danmaku either way.

### Output

One row per video, danmaku, comment and so on; `recordType` says which.

```json
{
  "recordType": "danmaku",
  "sourceType": "keyword",
  "sourceName": "原神",
  "bvid": "BV1s1CcBXE5f",
  "videoUrl": "https://www.bilibili.com/video/BV1s1CcBXE5f/",
  "videoTitle": "【团执】蒙眼play",
  "cid": 33890437355,
  "danmakuId": "2040383372635048192",
  "text": "这个视频的退出键在哪",
  "videoTimeSeconds": 0,
  "sentAt": "2026-02-05T20:37:32.000Z",
  "mode": "top",
  "fontSize": 25,
  "color": "#ffffff",
  "textTranslated": "Where is the exit button of this video",
  "translationLanguage": "en",
  "translationShared": false
}
```

(`textTranslated` and the two fields after it are there only with the `danmakuTranslation` layer; the translation shown here is an illustration of the field, not a measured model output.)

### Data table

| Row | Key fields |
|---|---|
| `video` | `bvid`, `aid`, `videoUrl`, `videoTitle`, `videoDescription`, `durationSeconds`, `publishedAt`, `category`, `tags`, `authorName`, `authorMid`, `authorProfileUrl`, `viewCount`, `danmakuCount`, `commentCount`, `favoriteCount`, `likeCount`, `coinCount`, `shareCount`, `matchedKeyword`, `rankInSearch`, `matchedIn`, `hasDetail`, `fieldsNotInListing`; with detail: `cid`, `parts`, `partCount`, `dimension`, `isOriginal`, `uploadedAt`, `subtitleCount`. `status: not-found` for a video you entered that does not exist |
| `danmaku` | `danmakuId`, `text`, `videoTimeSeconds`, `sentAt`, `mode`, `modeCode`, `fontSize`, `color`, `pool`, `weight`, `bvid`, `cid`, `videoTitle` |
| `danmakuProfile` | `danmakuFetched`, `danmakuReported`, `danmakuStoreLimit`, `danmakuPoolCapped`, `uniqueSenders`, `uniqueTexts`, `uniqueTextShare`, `danmakuPerMinute`, `peakFromSeconds`, `peakCount`, `firstSentAt`, `lastSentAt`, `timeline`, `peaks`, `topPhrases`, `reactionTypes` |
| `comment` | `commentId`, `parentCommentId`, `rootCommentId`, `isReply`, `text`, `likeCount`, `replyCount`, `postedAt`, `ipLocation`, `authorLevel`, `likedByUploader` |
| `relatedVideo` | `relatedBvid`, `relatedVideoUrl`, `relatedVideoTitle`, `relatedAuthorName`, `relatedViewCount`, `relatedDanmakuCount`, `rankInRelated` |
| `channel` | `mid`, `channelName`, `bio`, `level`, `followerCount`, `followingCount`, `videoCount`, `likesReceived`, `verified`, `videosListed`, `videosReported`, `medianDaysBetweenVideos`, `averageViews`, `medianViews`, `topVideos`, `videoListStatus`. `status: not-found` for a channel that does not exist |
| `keywordSummary` | `keyword`, `status` (`ok`, `no-results`, `partial`), `reportedTotal`, `videosReturned`, `dateWindowsRead`, `oldestPublishedAt`, `newestPublishedAt`, `viewCountSum`, `danmakuCountSum`, `commentCountSum`, `topChannels`, `emptyAnswers`, `emptyAnswersAnsweredOnRetry`, `emptyAnswersUnanswered`, `ai` (keyword insight) |
| `videoSummary` (AI layer) | `summary`, `sentiment`, `topics`, `moments` (`atSeconds`), `phrases` (with meaning), `evidenceIds` (danmaku and comment ids of this run) |
| `limits` | `requests`, `bilibili` (`askedAgain`, `gaveUp`), `search`, `danmaku`, `comments`, `sources`, `ai` (calls, spend, `discardReasons`), `charging` |
| notice rows | `noticeCode` (`free-plan-preview`, `free-plan-locked`, `invalid-input`, `source-failed`, `video-failed`, `charge-limit-reached`, …) and `message`. Never charged |

Every row carries `scrapedAt` and a `disclaimer`.

### AI layers (optional, paid plans)

Off by default. Switch on what you need with `ai`:

| Layer in `ai` | What you get | Event |
|---|---|---|
| `danmakuTranslation` | `textTranslated` on every danmaku row that holds Chinese text, and on the profile's repeated phrases | `danmaku-translated` |
| `translation` | `videoTitleTranslated` and `videoDescriptionTranslated` on video rows, `textTranslated` on comment rows (first 800 characters of an item) | `translated` |
| `videoSummary` | one `videoSummary` row per video with at least 20 danmaku and comments: what viewers reacted to, sentiment, topics, moments, repeated phrases with their meaning | `video-summarized` |
| `keywordInsight` | `ai` on the keyword result row: the contexts a keyword appears in, the channels that drive it, where videos differ | `keyword-insight` |

- **How danmaku translation is counted.** Per distinct line **of a video**: a line that appears 300 times in one video is translated and charged once, and the other rows carry the same translation with `translationShared: true`. A line whose translation was not charged (your maximum charge was reached first) is translated in no row. The same line in another video is charged once there too — so the translation price of a video is its number of distinct Chinese lines × $0.0002, whatever else is in the run. Lines without Chinese characters (numbers, Latin letters, symbols — about 14% in our sample) are not sent and not charged.
- **Checked before charged.** An answer is charged only after it passed our checks: a translation must be there and must differ from the source; a summary must cite danmaku, comments or videos that were in the request. What fails is counted in `limits.ai.discardReasons` under a fixed code (`line-missing`, `line-same`, `summary-uncited`, `cut-off`, …) and not charged.
- **Asked at most twice.** A summary is requested at most twice per run, restarts included.
- **When the platform restarts a run.** The run goes on where it was and charges nothing twice. Every hand-over goes in this order: the limit is counted, the rows are written to the dataset, their keys are saved in the run's record, and only then the charge is made. A restart skips what is on the record. If a run is cut right after a write and before the record is saved, the restart writes that batch again (the same rows can then be in the dataset twice) and charges it once; if it is cut between the record and the charge, that batch (at most 200 rows) was delivered and is not charged. `limits.ai.discardReasons` counts a summary that was never handed over.
- **Where the text goes.** Switching on a layer sends the public texts involved (danmaku, comments, titles, descriptions) to Anthropic's API (Claude), a company based in the United States. Leave `ai` empty to send nothing. The texts are sent as data; instructions written inside them are not followed.
- **Limits.** `aiMaxItems` caps what one run sends. There is also a ceiling on what one run may spend on the model (our cost, not yours); when it is reached the AI layers stop and the collection goes on. `limits.ai` says what happened.
- **Same price on every plan.** The four AI events have no plan tier discount.
- **Free plan.** A free run calls no model: `ai` is ignored and a `free-plan-locked` row says so.
- **Not measured yet.** The AI layers were built against recorded test answers; how well the translations read, and how often a summary matches what a person would write, has not been measured for this Actor yet. Read the cited danmaku before acting on a summary.
- **Your responsibility.** You decide whether this text may be sent to a model provider and what the output is used for.

### Pricing

Pay per event. The compute, proxy and storage a run uses are included in the event prices; Apify platform usage is not billed on top of them.

| Event | Charged when | Price (list) | Paid plan tiers | Not charged |
|---|---|---|---|---|
| `apify-actor-start` | the run starts — once per run (memory is limited to 1 GB) | $0.003 | same on every plan | — |
| `keyword-checked` | one keyword's search is completed (the keyword result row) — also when nothing was found | $0.004 | discounted | searches that failed or were cut short on our side; the same keyword twice |
| `channel-profiled` | one channel row is written — also the answer that a channel does not exist | $0.01 | discounted | lookups that failed or were cut short on our side; the same channel twice |
| `video` | one video row is written | $0.003 | discounted | duplicates (a video reached through two sources is delivered once); notice rows |
| `video-detail` | the lookup of a video (read whenever details, danmaku or comments are asked for): with its video row when video rows are on, otherwise with the first row of that video you receive (danmaku, profile, comment, related video, summary) — once per video; also the answer that a video you entered does not exist | $0.004 | discounted | lookups that failed on our side; a video that handed you no row |
| `danmaku` | one danmaku row is written — the price on the Store card; the lookup of the video, the reaction profile, comments and the AI layers are charged on top | $0.0005 | discounted | duplicates; notice rows |
| `danmaku-profiled` | one reaction profile row is written (videos with at least one danmaku) | $0.02 | discounted | videos without danmaku; lookups that failed on our side |
| `comment` | one comment or reply row is written | $0.002 | discounted | duplicates; notice rows |
| `related-video` | one related-video row is written | $0.001 | discounted | duplicates |
| `danmaku-translated` | one distinct danmaku line of a video is translated and passed the checks | $0.0002 | same on every plan | lines not translated, handed back unchanged or unusable; lines without Chinese characters |
| `translated` | one video (title + description) or one comment is translated and passed the checks | $0.002 | same on every plan | items not translated or handed back unchanged |
| `video-summarized` | one video summary row is written | $0.03 | same on every plan | summaries not delivered or citing nothing of this run |
| `keyword-insight` | one keyword insight is on its keyword row | $0.03 | same on every plan | insights not delivered or citing no video of this run |

Paid plan tiers for the eight collection events: BRONZE −20%, SILVER −35%, GOLD, PLATINUM and DIAMOND −48% off the list price.

**What a run costs.** One keyword, 20 videos, details, up to 500 danmaku per video, profiles and comments, no AI: at most 20 × ($0.003 + $0.004 + $0.25 + $0.02) + comments + $0.004 + $0.003 ≈ $5.5 plus comments at list price when every video holds 500 danmaku or more; most videos hold far fewer (the median in our sample of 31 videos was 47), so a typical run is well below that. Set a maximum charge per run in the Apify run options if you want a hard stop: the run ends there with what it has, as SUCCEEDED.

### Limits Bilibili sets, and how the run reports them

- **Search: 1,000 results per query.** Ask for more with `maxVideosPerSource` and the run splits the search into date windows (each window has its own 1,000), newest first.
- **Searches Bilibili does not answer.** Bilibili sometimes returns an empty answer to a search instead of results. The run does not treat that as "no results": it asks again, and for a plain relevance search without a date range it can fall back to Bilibili's general search (those videos are marked `discoveredVia: search-all`; that search knows no sort order and no dates, so other searches skip the fallback). If there is still no answer, the keyword ends with an unbilled `source-failed` notice row (or a `partial` summary when earlier pages were read) — never with a charged "no results". Measured on 2026-10-08: 60 of 60 first-page searches of different keywords were answered. The `limits` row counts empty answers and how they ended (`emptyAnswers`, `emptyAnswersAnsweredOnRetry`, `emptyAnswersUnanswered`).
- **Danmaku: a stored pool per video.** Bilibili keeps a limited number of danmaku per video, by its length (100 to 6,000), and returns up to 1.2 times that; older ones are gone. `danmakuProfile.danmakuReported` is how many were ever sent, `danmakuFetched` how many exist now. For a video with several parts, the danmaku of the first part is read.
- **Comments without login.** For each video the run returns the top comments Bilibili shows to a visitor who is not logged in — usually 3, with the replies shown under them — and the total comment count (`commentCount`). It does not log in, so it cannot page through all comments.
- **Subtitles** need a login and are not returned (`subtitleCount` on a detailed video row says how many exist).
- **Refused requests.** Bilibili limits how many video requests it answers in a row. A refused request is repeated (3 attempts in all); what could not be read is reported in a `video-failed` or `source-failed` notice row and not charged.

### What it does not do

- It does not log in and takes no cookie or account of yours.
- It does not download video or audio files.
- It keeps nothing between runs: there is no "new items only" mode. Use `sortOrder: newest` with `since` to read a recent window.
- It does not turn English brand names into Chinese search terms for you.

### FAQ, disclaimers, and support

**Is this legal?** The Actor reads pages that Bilibili serves publicly to anyone without an account. Whether a particular use of that data is lawful depends on what you collect and what you do with it. You are responsible for how you use the results. Do not use this tool for harassment, stalking, or any unlawful purpose.

**Privacy & data responsibility.** **You are the data controller** for every run you start with this Actor; ntriqpro is a **data processor** acting solely on your instructions. Danmaku and comment rows leave out who sent or wrote them: no sender hash, and no commenter number, name, picture or profile address. Channel (uploader) details are public channel information and stay. You are responsible for having a lawful basis for the data you collect and for complying with GDPR, PIPL, PIPA, CCPA and other applicable privacy laws. We do not store your results — they are in your own Apify dataset.

**A run ended with a notice row instead of data.** Read its `message`: it says what was limited (free plan, your maximum charge, a source Bilibili refused) and what was not charged.

**Support.** Open an issue on the Actor's Issues tab with the run id.

### Tell us what output you need

Missing a field, a source, or an export shape? Open a request on the **Issues** tab and describe the output you want: the columns you need, an example row, or the tool you feed the data into. We read every request, answer on the same thread, and build the ones that fit this Actor.

缺少你需要的字段、来源或输出格式？请在 **Issues** 标签页告诉我们你想要的输出（需要的列、示例行，或你用来处理数据的工具）。我们会阅读每一条请求并在同一帖子里回复。

# Actor input Schema

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

Video searches, one per entry. Chinese keywords find far more than English ones (特斯拉 rather than Tesla, 泡泡玛特 rather than Pop Mart). Each keyword gives video rows, the danmaku and comments of those videos, and one keyword result row (totals, date range, top channels). Paid Apify plans read up to 200 targets per run and up to 1,000 videos per search (more with date windows). Free plan runs are a preview: 2 targets, 5 videos each, 20 danmaku and 1 comment per video. Charged per keyword checked ($0.004), per video ($0.003 + $0.004 for its detail) and per danmaku row ($0.0005).

## `videos` (type: `array`):

Single videos: a BV number (BV1GJ411x7h7), an av number (av170001) or a bilibili.com video address. Only the id is taken from an address — the Actor builds its own requests. b23.tv short links are not accepted. A video that does not exist is answered with a row saying so.

## `channels` (type: `array`):

Creator channels: a mid (491190876) or a space.bilibili.com address. Each gives one channel row (followers, video count, posting rhythm, average and median views, top videos) and the channel's videos, newest first, with their danmaku and comments.

## `includeTrending` (type: `boolean`):

Adds the videos of Bilibili's popular list (site-wide, newest ranking) as video rows marked discoveredVia: trending, up to the videos-per-source limit. Default: off.

## `include` (type: `array`):

Which kinds of rows to return. Default: videos, details, danmaku, danmakuProfile and comments. details adds coins, shares, tags and parts to each video row ($0.004 per video, charged once per video even when video rows are off — then with the first danmaku, profile, comment or related row of that video; read anyway when danmaku or comments are asked for). danmakuProfile is one counted reaction profile per video with danmaku ($0.02). related adds up to 40 related-video rows per video ($0.001 each). Free plan runs show 20 danmaku, 1 comment and 3 related videos per video.

## `maxVideosPerSource` (type: `integer`):

Default 20 through the API; the Console form is pre-filled with 5 (the free-plan size). How many videos to read per keyword, per channel and from the popular list. One Bilibili search answers 1,000 at most; above 1,000 the run splits the search into date windows, newest first. More than 5 (paid Apify plans only — free plan runs ignore this and say so).

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

Default 500 through the API; the Console form is pre-filled with 100. Upper limit of danmaku rows per video, spread evenly over the video's length. 500 rows cost at most $0.25 per video at the Free-tier price; 0 returns every danmaku Bilibili stores for the video (it stores 100 to 6,000 depending on the video's length, and returns up to 1.2 times that). The reaction profile is always counted from all of them. More than 20 (paid Apify plans only — free plan runs ignore this and say so).

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

Order of keyword search results (paid Apify plans only — free plan runs ignore this and say so). Default: relevance.

## `since` (type: `string`):

Only videos published on or after this date (YYYY-MM-DD), for keyword searches (paid Apify plans only — free plan runs ignore this and say so).

## `until` (type: `string`):

Only videos published before this date (YYYY-MM-DD), for keyword searches (paid Apify plans only — free plan runs ignore this and say so).

## `ai` (type: `array`):

Optional, off by default (paid Apify plans only — free plan runs ignore this and say so). danmakuTranslation: every distinct danmaku line of a video translated ($0.0002 per distinct line, counted per video). translation: video title + description and comments translated ($0.002 each). videoSummary: one row per video on what viewers reacted to, with the danmaku it is based on ($0.03). keywordInsight: how the keyword is covered, on the keyword result row ($0.03). Charged only for answers that passed our checks. Turning a layer on sends the public texts involved (danmaku, comments, titles, descriptions) to Anthropic's API (Claude, a company based in the United States); leave it off to send nothing.

## `aiLanguage` (type: `string`):

Language code for translations and summaries (en, ja, ko, de, …). Default en.

## `aiMaxItems` (type: `integer`):

Default 5,000. Upper limit of texts sent to the language model in one run (a danmaku line, a comment, a video and a summary each count as one). The AI layers stop there; the collection goes on.

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

Apify Proxy settings. Keep Apify Proxy on; the default datacenter proxy is what the Actor was measured with.

## Actor input object example

```json
{
  "keywords": [
    "原神"
  ],
  "videos": [],
  "channels": [],
  "maxVideosPerSource": 5,
  "maxDanmakuPerVideo": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

# 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": [
        "原神"
    ],
    "videos": [],
    "channels": [],
    "maxVideosPerSource": 5,
    "maxDanmakuPerVideo": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("ntriqpro/bilibili-video-danmaku-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": ["原神"],
    "videos": [],
    "channels": [],
    "maxVideosPerSource": 5,
    "maxDanmakuPerVideo": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("ntriqpro/bilibili-video-danmaku-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": [
    "原神"
  ],
  "videos": [],
  "channels": [],
  "maxVideosPerSource": 5,
  "maxDanmakuPerVideo": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call ntriqpro/bilibili-video-danmaku-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ntriqpro/bilibili-video-danmaku-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/YOaaTS6f2hgdsHkb9/builds/N1FExY004bMnoWYQU/openapi.json
