# Bilibili Scraper (`automly/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩 / B站) videos by keyword or link, creators (UP主) and their uploads, comments with replies, danmaku and the popular and ranking lists: views, likes, coins, favorites, shares, tags and follower counts. No login or cookies.

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

## Pricing

from $1.79 / 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

### What is Bilibili Scraper?

**Bilibili Scraper** is a tool that lets you **scrape Bilibili (哔哩哔哩 / B站) videos, creators (UP主), comments and danmaku**: titles, descriptions, exact views, likes, coins, favorites, shares, comment and danmaku counts, tags, categories, cover images and creator follower counts. Search by keyword or paste Bilibili links, click **Start**, and download the data as Excel, CSV or JSON.

- ⚡ **Fast:** 1,000 videos with every count in under 2 minutes, 1,000 comments in under 40 seconds (our tests)
- 📊 **Every count on every video:** views, likes, coins (投币), favorites (收藏), shares, comments and danmaku, whether the video came from a search, a link, a creator or a trending list
- 🔎 **Search past 1,000 results:** Bilibili shows 1,000 results per search; the rest of a video search is read newest first, so you can collect thousands of videos for one keyword
- 💬 **Comments with replies (楼中楼)** and **danmaku (弹幕)** with the second of the video each one appears at
- 🔓 **No login:** no Bilibili account, cookies or API key needed

### What can Bilibili Scraper do?

- **Search Bilibili videos by keyword**, in Chinese or English, sorted like Bilibili's own search (most relevant, most viewed, newest, most danmaku, most favorited, most commented), filtered by length and publish date
- **Find Bilibili creators (UP主) by keyword** with their followers, total likes and upload count
- Scrape any public **Bilibili video** from its link, BV id, av number or b23.tv share link
- Scrape **Bilibili creator profiles** and each creator's **newest uploads** with full stats
- Scrape **Bilibili comments**, hot or newest first, with likes, reply counts and the replies themselves
- Get each video's **danmaku**: every bullet comment with its time in the video, text, color and position
- Get **Bilibili's trending lists**: Popular now (综合热门), Weekly must-watch (入站必刷) and the ranking (排行榜) of any category
- Export to Excel, CSV, JSON, HTML or XML, or send the data to Google Sheets, Make, Zapier and more

### What data can you extract from Bilibili?

| | | |
|---|---|---|
| 🎬 Title, description and tags | ▶️ Views (播放) | 👍 Likes |
| 🪙 Coins (投币) | ⭐ Favorites (收藏) | 🔁 Shares |
| 💬 Comment count | 📜 Danmaku count | ⏱️ Duration, size and parts (分P) |
| 🗂️ Category (分区) | 🖼️ Cover image | 📅 Publish date and time |
| 👤 Creator name, UID and page link | 👥 Followers, following, total likes | 🎞️ Creator's upload count and level |
| 💬 Comment text, likes, replies and pictures | 📜 Danmaku text, time, color and position | 🏆 Rank on the search or trending list |

### How to scrape Bilibili

1. [Create a free Apify account](https://console.apify.com/sign-up) (no credit card needed).
2. Open **Bilibili Scraper**.
3. Type **search terms**, or paste **Bilibili links** (videos, creators, b23.tv share links), one per line. You can also pick a **trending list**.
4. Choose how many results you want, and turn on **comments** or **danmaku** if you need them. Click **Start**.
5. When the run finishes, download your data as Excel, CSV, JSON, HTML or XML.

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

You pay only for the results you get: per video, creator, comment and video's danmaku. The prices for each Apify plan are on the **Pricing** tab, with platform usage included, so you pay nothing else for the run.

**Max results per search or list** and **Max rows in total** keep a run's cost under control, and you can also set a maximum cost per run. Every Apify account gets **$5 of free usage each month**, so you can try the scraper at no cost.

### ⬇️ Input

| Setting | What it does |
|---|---|
| Search terms | Keywords to search, one per line (Chinese or English) |
| Search for | Videos (default) or creators (UP主) |
| Max results per search or list | Most videos or creators to save from each search term and from the trending list (default 100) |
| Bilibili links | Video links, BV ids, av numbers, creator links or UIDs, b23.tv share links or search links |
| Videos per creator | How many of each creator's newest uploads to save (default 20; 0 for the profile only) |
| Sort by | Most relevant, most viewed, newest, most danmaku, most favorited or most commented |
| Video length | Any, under 10 minutes, 10-30, 30-60 or over 60 minutes |
| Published after / before | Only videos published in this date range, e.g. 2026-01-01 or 3 months |
| Trending videos | Popular now, Weekly must-watch, or the ranking of a category (all, anime, music, dance, games, knowledge, tech, sports, cars, life, food, animals, kichiku, fashion, entertainment, film & TV) |
| Include comments | Also save the comments of every video saved |
| Comments per video | Most top-level comments per video (default 100) |
| Sort comments by | Hot or newest |
| Replies per comment | Also save up to this many replies to each comment (default 0) |
| Include danmaku | Also save each video's danmaku as one row per video |
| Max rows in total | Most rows in the whole run, all types together (0 for no limit) |

Example: the 500 most viewed videos about 人工智能 published this year, with 50 comments each.

```json
{
  "searchTerms": ["人工智能"],
  "sortBy": "views",
  "publishedAfter": "2026-01-01",
  "maxResults": 500,
  "includeComments": true,
  "commentsPerVideo": 50
}
```

Example: two creators with their 30 newest uploads, one video with its danmaku, and today's ranking for games.

```json
{
  "startUrls": [
    "https://space.bilibili.com/546195",
    "https://space.bilibili.com/2",
    "https://www.bilibili.com/video/BV14Enb6LEBX"
  ],
  "videosPerCreator": 30,
  "includeDanmaku": true,
  "trending": "ranking-game"
}
```

### ⬆️ Output

Every row has a `type`: **video**, **creator**, **comment** (replies too, with `isReply` set) or **danmaku**. You can view the rows as a table in Apify Console or download them as Excel, CSV, JSON, HTML or XML.

A video:

```json
{
  "type": "video",
  "id": "BV14Enb6LEBX",
  "aid": "117489115601774",
  "url": "https://www.bilibili.com/video/BV14Enb6LEBX",
  "title": "《原神》7.2版本「坏灭肇始之时」前瞻特别节目",
  "description": "《原神》7.2版本「坏灭肇始之时」将于2026年11月4日上线。\n感谢各位旅行者的支持与陪伴，我们将为大家带来更多7.2版本的最新消息~\n\n本次兑换码将于2026年10月26日12:00:00失效，记得尽快兑换哦~\n\n《原神》bilibili服下载地址： https://www.biligame.com/detail/?id=103496",
  "publishedAt": "2026-10-23T12:50:00Z",
  "durationSeconds": 2348,
  "views": 1729551,
  "likes": 106390,
  "coins": 24697,
  "favorites": 23284,
  "shares": 6283,
  "comments": 15878,
  "danmakuCount": 18271,
  "tags": [
    "坏灭肇始之时",
    "原神7.2",
    "原神",
    "miHoYo",
    "米哈游"
  ],
  "category": "手机游戏",
  "categoryId": 2064,
  "coverUrl": "https://i1.hdslb.com/bfs/archive/0a8b7a665ee98ac794e4cc9712de79a726bb7ae4.jpg",
  "parts": 1,
  "width": 2560,
  "height": 1440,
  "isReprint": false,
  "rank": 1,
  "authorName": "原神",
  "authorId": "401742377",
  "authorUrl": "https://space.bilibili.com/401742377",
  "authorAvatarUrl": "https://i2.hdslb.com/bfs/face/e63bacc8b9e68f59f401cc41728a99262ba661a3.jpg",
  "source": "原神",
  "scrapedAt": "2026-10-27T19:34:13Z"
}
```

A creator:

```json
{
  "type": "creator",
  "id": "2",
  "url": "https://space.bilibili.com/2",
  "name": "碧诗",
  "bio": "https://kami.im 直男过气网红 #  We Are Star Dust",
  "avatarUrl": "https://i2.hdslb.com/bfs/face/ef0457addb24141e15dfac6fbf45293ccf1e32ab.jpg",
  "level": 6,
  "followers": 1433627,
  "following": 430,
  "videos": 44,
  "articles": 0,
  "likes": 5097129,
  "verified": "bilibili创始人（站长）",
  "source": "https://space.bilibili.com/2",
  "scrapedAt": "2026-10-27T19:34:13Z"
}
```

A comment:

```json
{
  "type": "comment",
  "id": "321378400944",
  "videoId": "BV1shnv6hEx2",
  "videoUrl": "https://www.bilibili.com/video/BV1shnv6hEx2",
  "text": "有帮助的话还请三连支持一下！\n原神最全的攻略导航：https://www.bilibili.com/read/cv13698984",
  "publishedAt": "2026-10-21T02:41:21Z",
  "likes": 56,
  "replies": 2,
  "isReply": false,
  "replyTo": null,
  "likedByAuthor": false,
  "repliedByAuthor": false,
  "images": [],
  "authorName": "你的影月月",
  "authorId": "431073645",
  "authorUrl": "https://space.bilibili.com/431073645",
  "authorLevel": 6,
  "authorAvatarUrl": "https://i0.hdslb.com/bfs/face/2e32de7b28fc491a28281a22c6ea9f5d195cbdf5.jpg",
  "source": "原神",
  "scrapedAt": "2026-10-27T19:34:13Z"
}
```

A video's danmaku (two of its entries shown):

```json
{
  "type": "danmaku",
  "videoId": "BV1shnv6hEx2",
  "videoUrl": "https://www.bilibili.com/video/BV1shnv6hEx2",
  "title": "【原神】无忧无虑大雪仗 活动攻略/联机/打雪仗/雪球欢意/原神7.1",
  "danmakuCount": 76,
  "danmakuInPool": 76,
  "uniqueSenders": 70,
  "danmaku": [
    {
      "time": 0.54,
      "text": "联机的都是队友",
      "sentAt": "2026-10-21T03:08:10Z",
      "mode": "scroll",
      "color": "#ffffff",
      "fontSize": 25
    },
    {
      "time": 0.66,
      "text": "好快",
      "sentAt": "2026-10-21T02:37:39Z",
      "mode": "scroll",
      "color": "#ffffff",
      "fontSize": 25
    }
  ],
  "source": "原神",
  "scrapedAt": "2026-10-27T19:34:13Z"
}
```

Each run also saves a short report listing every input with the rows it gave, and any input that could not be scraped with the reason (for example, a deleted video or a creator that does not exist).

### How can I use Bilibili data?

- **Market research in China:** see which products, games, topics and formats take off with Bilibili's young audience
- **Influencer marketing (KOL):** check a creator's followers, total likes and the views, coins and favorites of their newest uploads before a deal
- **Brand and competitor tracking:** search your brand or a competitor and follow the videos, comments and danmaku about it
- **Trend spotting:** pull the popular list or a category ranking every day and see what is rising
- **Sentiment and AI datasets:** build comment and danmaku datasets for sentiment, topic or audience analysis
- **Content research:** find the best-performing videos for a keyword, with their tags, length and category

### How to track a Bilibili keyword, creator or ranking

1. Add the search term or creator link (or pick a trending list).
2. [Schedule the actor](https://docs.apify.com/platform/schedules) to run every day or every hour. For a keyword, sort by **Newest** and set **Published after** to a short span such as `1 day`.
3. Send each run's rows to Google Sheets, Slack or your database with an [integration](https://apify.com/integrations).

Each run gives the current counts, so you can chart a creator's followers or a video's views over time.

### Use Bilibili Scraper from your code

Run the actor with the [Apify API](https://docs.apify.com/api/v2) or the Python and JavaScript clients:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("automly/bilibili-scraper").call(run_input={
    "searchTerms": ["原神"],
    "maxResults": 200,
    "sortBy": "views",
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["type"], row.get("title"), row.get("views"))
```

### Use with AI agents (MCP)

Bilibili Scraper works with AI agents through the Apify MCP server. Ask your agent, for example: "Find the 50 most viewed Bilibili videos about Minecraft with their likes, coins and comments" and it will run the actor with:

```json
{"searchTerms": ["minecraft"], "sortBy": "views", "maxResults": 50}
```

### ❓FAQ

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

You pay only for the results you get, per video, creator, comment and video's danmaku, with platform usage included. The **Pricing** tab shows the price on every Apify plan. Every Apify account gets $5 of free usage each month, so you can try it at no cost.

#### How many videos can I get from one Bilibili search?

As many as Bilibili has for the keyword. Bilibili's search shows 1,000 results per search; when you ask for more, the scraper reads the rest newest first, one date range after another, and skips videos it already saved. The run report says when a search went past 1,000.

#### How many comments can I scrape from one Bilibili video?

As many as you ask for in **Comments per video**, hot or newest first. Replies (楼中楼) come on top of that when **Replies per comment** is above 0. The comment count on a video row includes replies.

#### What is danmaku and what does the scraper return?

Danmaku (弹幕) are the bullet comments viewers write over the video at a given second. With **Include danmaku** on, each video gets one row with every danmaku Bilibili keeps for it: the second of the video, the text, when it was sent, its color, size and position (scrolling, top or bottom), plus how many different viewers sent them. For long and very busy videos Bilibili keeps a capped number, so `danmakuInPool` can be lower than the video's `danmakuCount`.

#### Can I get all the videos of a Bilibili creator?

Yes. Set **Videos per creator** to the creator's upload count (or more), and every upload is saved newest first with full stats. Use **Published after** to keep only recent ones.

#### Can I scrape subtitles or download the video files?

No. The scraper returns data about the videos (counts, text, tags, links), not the video files. Subtitles are not included.

#### Do I need a Bilibili account?

No. You don't need a Bilibili account, cookies, an API key or a Chinese phone number.

#### Can I scrape private or deleted videos?

No. Only public data can be scraped. Deleted, hidden or mistyped links are listed in the run report as not found.

#### Is it legal to scrape Bilibili?

This scraper only collects data that people chose to publish publicly. It does not collect private data such as email addresses or phone numbers, and creator rows keep to the public profile basics (name, bio, avatar, level and counts). Public profiles and comments can still contain personal data, which may be protected by laws such as GDPR or China's PIPL, so only scrape it for a legitimate reason and ask a lawyer if you are unsure. You can read more in [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

Bilibili Scraper is an independent tool. It is not affiliated with, endorsed by or sponsored by Bilibili.

#### Something isn't working. What should I do?

Open the **Issues** tab and tell us the input and what you expected. We usually reply within a day. If the scraper helps you, a review on the **Reviews** tab helps others find it.

# Actor input Schema

## `searchTerms` (type: `array`):

Keywords to search on Bilibili, one per line, e.g. 原神, minecraft or 人工智能. Chinese and English both work. Each term is searched on its own; see Search for, Sort by and the date filters below.

## `searchFor` (type: `string`):

What the search terms find: videos (default) or creators (UP主). A creator found by search is saved with their newest uploads (see Videos per creator).

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

Most videos (or creators) to save from each search term and from the trending list, e.g. 100. Bilibili shows 1,000 results per search; past that, the rest of a video search is read newest first, so large numbers work too.

## `startUrls` (type: `array`):

Video links, BV or av ids, creator links or UIDs, b23.tv share links or search links, one per line, e.g. https://www.bilibili.com/video/BV14Enb6LEBX, BV14Enb6LEBX, av170001, https://space.bilibili.com/546195, 546195 or https://b23.tv/xxxx. A video link gives that video; a creator gives the creator's profile and newest uploads; a search link searches its keyword.

## `videosPerCreator` (type: `integer`):

How many of each creator's newest uploads to save, e.g. 20. Set 0 for the creator's profile row only. The date filters below apply to uploads too.

## `sortBy` (type: `string`):

Order of video search results, as on Bilibili's own search page.

## `duration` (type: `string`):

Keep only videos of this length in video searches.

## `publishedAfter` (type: `string`):

Only videos published on or after this date, e.g. 2026-01-01, or within a time span, e.g. 3 months. Applies to video searches and creators' uploads.

## `publishedBefore` (type: `string`):

Only videos published on or before this date, e.g. 2026-06-30. Applies to video searches and creators' uploads.

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

Also save one of Bilibili's trending lists, e.g. Popular now or the ranking of a category, with each video's place on the list. Works with no search terms or links too. Max results per search or list caps it.

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

Also save the comments of every video saved (from searches, links, creators and trending lists). Each comment is its own row.

## `commentsPerVideo` (type: `integer`):

Most top-level comments to save per video, e.g. 100.

## `commentsSort` (type: `string`):

Which comments come first.

## `repliesPerComment` (type: `integer`):

Also save up to this many replies (楼中楼) to each saved comment, e.g. 10. 0 saves no replies. Each reply is its own comment row.

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

Also save each video's danmaku (弹幕, the bullet comments shown over the video) as one row per video: every danmaku with its second in the video, text, time sent, color and position.

## `maxItems` (type: `integer`):

Most rows to save in the whole run (videos, creators, comments and danmaku together), e.g. 1000. 0 means no limit beyond the settings above.

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

Leave the default.

## Actor input object example

```json
{
  "searchTerms": [
    "原神"
  ],
  "searchFor": "videos",
  "maxResults": 20,
  "videosPerCreator": 20,
  "sortBy": "relevance",
  "duration": "any",
  "trending": "none",
  "includeComments": false,
  "commentsPerVideo": 100,
  "commentsSort": "hot",
  "repliesPerComment": 0,
  "includeDanmaku": false,
  "maxItems": 0,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

## `details` (type: `string`):

No description

## `results` (type: `string`):

No description

## `report` (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 = {
    "searchTerms": [
        "原神"
    ],
    "maxResults": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("automly/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 = {
    "searchTerms": ["原神"],
    "maxResults": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

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