# Bilibili Scraper - Videos, Comments, Danmaku & Search (`tenfoldfleet/bilibili-scraper`) Actor

Scrape Bilibili videos, comments and danmaku: search Bilibili (B站) by keyword, get video stats (views, likes, coins, favorites), comments, bullet comments (弹幕) and creator uploads. No login. $5 per 1,000 videos or comments, $0.10 per 1,000 danmaku; failures are free.

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

## Pricing

from $5.00 / 1,000 video or comments

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

### What does Bilibili Scraper do?

**Bilibili Scraper** gets public data from [Bilibili](https://www.bilibili.com) (哔哩哔哩, B站), China's largest video community, through a simple **Bilibili API**. In one run you can:

- **Search Bilibili videos** by keyword (Chinese or English), sorted by relevance, views, date, danmaku, favorites or comments.
- Get **video details and stats**: views, likes, coins, favorites, shares, danmaku and comment counts, duration, parts and uploader.
- Scrape **Bilibili comments** (hot or newest first) with likes, reply counts and IP region.
- Download **danmaku (弹幕, bullet comments)** with the exact video time, mode, color and send time.
- List a **creator's uploads** (UP主 videos), newest first.

No login, no cookies and no browser: requests are signed like the Bilibili web and app clients, with automatic retries when Bilibili rate-limits.

### Why use it?

- **Market and trend research** on Chinese audiences: which topics, games and brands get views on Bilibili.
- **Brand and campaign monitoring**: search a brand name and track views, likes and comments over time.
- **Influencer (KOL) research**: compare a creator's recent uploads and engagement.
- **Sentiment analysis and NLP**: comments and danmaku are rich, real-time audience reactions.
- **AI agents and data pipelines**: clean JSON rows that are easy to feed into an LLM or a database.

### What data can it extract?

| Result type | Fields |
|---|---|
| Video | bvid, aid, url, title, description, authorName, authorMid, category, tags, durationSecs, views, likes, coins, favorites, shares, danmakuCount, comments, publishedAt, thumbnail, parts |
| Comment | commentId, text, likes, replyCount, authorName, authorMid, authorLevel, location (IP region), isPinned, postedAt |
| Danmaku | danmakuId, text, videoTimeSecs, mode, fontSize, color, sentAt, cid |

### How to scrape Bilibili

1. Open the Actor and add **search keywords**, **video URLs** and/or **creator ids**.
2. For video URLs, choose what you want: **video details**, **comments** and/or **danmaku**.
3. Set the limits (videos per search, comments per video, danmaku per video).
4. Click **Start** and download the results.

### How much does it cost to scrape Bilibili?

Pay per result, no subscription:

- **$5 per 1,000 videos or comments** ($0.005 each).
- **$0.10 per 1,000 danmaku** ($0.0001 each), so a video with 3,000 danmaku costs $0.30.
- **Failed inputs are free**: deleted videos, empty searches and blocked requests are returned as error rows and not charged.

### Input

```json
{
    "searchQueries": ["原神", "minecraft"],
    "maxResults": 20,
    "videoUrls": ["https://www.bilibili.com/video/BV17x411w7KC"],
    "scrapeVideoDetails": true,
    "scrapeComments": true,
    "maxComments": 100,
    "scrapeDanmaku": true,
    "maxDanmakuPerVideo": 2000,
    "creatorIds": ["546195"]
}
```

### Output

You can download the dataset as JSON, CSV, Excel, XML or HTML. A video row looks like this:

```json
{
    "type": "video",
    "bvid": "BV17x411w7KC",
    "aid": 170001,
    "url": "https://www.bilibili.com/video/BV17x411w7KC",
    "title": "【MV】保加利亚妖王AZIS视频合辑",
    "authorName": "冰封.虾子",
    "authorMid": 122541,
    "durationSecs": 2412,
    "views": 45816638,
    "likes": 943114,
    "coins": 294962,
    "favorites": 877182,
    "danmakuCount": 915672,
    "comments": 184110,
    "publishedAt": "2011-11-09T14:55:33.000Z"
}
```

A danmaku row:

```json
{ "type": "danmaku", "bvid": "BV17x411w7KC", "text": "前方高能", "videoTimeSecs": 196.551, "mode": "scroll", "color": "#ffffff", "sentAt": "2025-01-20T13:36:26.000Z" }
```

### Tips

- BV ids, av ids, full URLs and b23.tv short links all work. The same video given twice (for example as a URL and as an av id) is scraped and charged only once.
- Keep **Max concurrency** low (3 is the default). Bilibili rate-limits fast clients, and the Actor retries blocked pages with a new session and IP.
- Bilibili serves only the most recent few thousand danmaku per video.
- Search returns at most about 1,000 videos per keyword; use several keywords or sort orders for more.

### FAQ

#### Do I need a Bilibili account or cookies?

No. The Actor uses only public, anonymous endpoints.

#### Can it scrape creator profiles or follower lists?

No. It scrapes public videos, comments and danmaku only, not user profiles or follower lists.

#### Why did an input return an error row?

The video may be deleted, region-locked or private, the search may have no results, or Bilibili may have blocked every retry. Error rows are free.

#### Can I use it through an API or with AI agents?

Yes. Call it through the Apify API, the Apify MCP server or any Apify integration, and read the results as JSON.

### Disclaimer

This Actor collects only publicly available data. Comments include public usernames and user ids; process them in line with GDPR and other data-protection laws, and use the data only for legitimate purposes. Bilibili is a trademark of its owner; this Actor is not affiliated with or endorsed by Bilibili.

### More tools from Tenfold Fleet

| Actor | Price |
|---|---|
| [AliExpress Products Scraper - Search, Prices & Sold Count](https://apify.com/tenfoldfleet/aliexpress-search-scraper) | $1.5 per 1,000 (product) |
| [Amazon Product Scraper - Details, Prices & Search by ASIN](https://apify.com/tenfoldfleet/amazon-product-scraper) | $1.5 per 1,000 (product) |
| [ATS Jobs Scraper - Greenhouse, Lever, Ashby & 5 More](https://apify.com/tenfoldfleet/ats-jobs-scraper) | $2 per 1,000 (job posting) |
| [Contact Details Scraper - Website Email & Phone Extractor](https://apify.com/tenfoldfleet/company-contact-finder) | $8 per 1,000 (website with contacts) |
| [Google Ads Transparency Center Scraper - Competitor Ads by Site](https://apify.com/tenfoldfleet/google-ads-transparency-scraper) | $1 per 1,000 (ad) |
| [Google News Scraper - Articles, Real URLs & Full Text](https://apify.com/tenfoldfleet/google-news-scraper) | $2 per 1,000 (article) |
| [Google Trends Scraper - Interest, Regions & Related Queries](https://apify.com/tenfoldfleet/google-trends-scraper) | $2 per 1,000 (keyword) |
| [Keyword Search Volume, CPC & Difficulty Checker (Bulk)](https://apify.com/tenfoldfleet/keyword-search-volume) | $5 per 1,000 (keyword with data) |
| [Remote Jobs Aggregator - RemoteOK, WWR, Himalayas & 4 more](https://apify.com/tenfoldfleet/remote-jobs-aggregator) | $1.2 per 1,000 (unique remote job) |
| [SEEK Job Scraper - Australia, NZ, Jobstreet & JobsDB](https://apify.com/tenfoldfleet/seek-job-scraper) | $0.9 per 1,000 (job listing) |
| [SEO Audit Tool - Technical On-Page SEO Checker & Score](https://apify.com/tenfoldfleet/seo-audit-tool) | $20 per 1,000 (page audit) |
| [Shopify Products Scraper - Prices, Variants & Stock](https://apify.com/tenfoldfleet/shopify-products-scraper) | $0.8 per 1,000 (product) |
| [Shopify App & Theme Detector - Store Analyzer & Contacts](https://apify.com/tenfoldfleet/shopify-store-analyzer) | $8 per 1,000 (shopify store) |
| [Sitemap URL Extractor - All URLs from sitemap.xml & robots.txt](https://apify.com/tenfoldfleet/sitemap-url-extractor) | $0.4 per 1,000 (url) |
| [Technology Detector - Wappalyzer & BuiltWith Alternative](https://apify.com/tenfoldfleet/tech-stack-detector) | $10 per 1,000 (website) |
| [URL to Markdown - Web Page to LLM-Ready Text for AI Agents](https://apify.com/tenfoldfleet/url-to-markdown) | $1 per 1,000 (page) |
| [Workday Jobs Scraper - myworkdayjobs.com API with Salary](https://apify.com/tenfoldfleet/workday-jobs-scraper) | $1.5 per 1,000 (job posting) |
| [YouTube Comments Scraper - Replies, Likes & Sort by Newest](https://apify.com/tenfoldfleet/youtube-comments-scraper) | $0.6 per 1,000 (comment) |
| [YouTube Shorts Scraper - Views, Likes & Hashtags by Channel](https://apify.com/tenfoldfleet/youtube-shorts-scraper) | $2 per 1,000 (short) |
| [YouTube Transcript Scraper - Captions & Subtitles API](https://apify.com/tenfoldfleet/youtube-transcript-scraper) | $3 per 1,000 (transcript) |

# Actor input Schema

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

Keywords to search on Bilibili, in Chinese or English, e.g. 原神 or minecraft. Each keyword returns up to "Max videos per search or creator" videos with views, likes, danmaku and comment counts.

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

Bilibili video links (https://www.bilibili.com/video/BV...), b23.tv short links, BV ids (BV17x411w7KC) or av ids (av170001). Choose below what to get for each video: details, comments and/or danmaku. Add ?p=2 to a URL to get the danmaku of another part of a multi-part video.

## `creatorIds` (type: `array`):

Creator UIDs (mid), e.g. 401742377, or links like https://space.bilibili.com/401742377. Returns the creator's videos, newest first. Creator profiles and follower lists are not scraped.

## `scrapeVideoDetails` (type: `boolean`):

For each video URL: title, description, views, likes, coins, favorites, shares, danmaku and comment counts, duration, parts and uploader.

## `scrapeComments` (type: `boolean`):

For each video URL: top-level comments with text, likes, reply count, author name, author level, IP region and date.

## `scrapeDanmaku` (type: `boolean`):

For each video URL: the danmaku (弹幕) shown over the video, with text, video time, mode, color and send time. Billed per danmaku at a lower price.

## `maxResults` (type: `integer`):

Maximum videos per search keyword or creator. Search returns at most about 1,000 videos per keyword.

## `maxComments` (type: `integer`):

Maximum top-level comments per video (when Comments is on).

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

How to sort search results (Search mode).

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

Only videos of this length (search only).

## `commentSort` (type: `string`):

Most liked (hot) or newest first.

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

Maximum danmaku per video (when Danmaku is on), in video-time order. Bilibili serves up to a few thousand of the most recent danmaku per video.

## `maxConcurrency` (type: `integer`):

How many inputs to process in parallel. Keep it low: Bilibili rate-limits fast clients.

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

Optional. Leave empty for automatic proxies (direct first, then Apify datacenter, then residential when Bilibili blocks a request).

## Actor input object example

```json
{
  "searchQueries": [
    "原神",
    "minecraft"
  ],
  "scrapeVideoDetails": true,
  "scrapeComments": false,
  "scrapeDanmaku": false,
  "maxResults": 20,
  "maxComments": 100,
  "sortOrder": "totalrank",
  "durationFilter": "0",
  "commentSort": "hot",
  "maxDanmakuPerVideo": 2000,
  "maxConcurrency": 3
}
```

# Actor output Schema

## `results` (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 = {
    "searchQueries": [
        "原神",
        "minecraft"
    ],
    "maxResults": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("tenfoldfleet/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",
    ],
    "maxResults": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("tenfoldfleet/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"
  ],
  "maxResults": 20
}' |
apify call tenfoldfleet/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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