# Bilibili Scraper 哔哩哔哩采集器 - Videos, Profiles, Comments & Search (`lofomachines/bilibili-scraper`) Actor

Bilibili scraper API / 哔哩哔哩(B站)数据采集. Extract videos, creator profiles, stats, tags and comments by keyword or URL. 视频/UP主/评论/搜索数据导出 Excel/CSV/JSON. No login required 无需登录. Fast, Cheap. AI-Agent friendly.

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

## Pricing

from $2.00 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Bilibili Scraper – Videos, Creators, Search & Comments Data Export

**Extract clean, structured data from Bilibili in seconds – no login, no cookies, no setup.** Search by keyword, paste any Bilibili link, or pull an entire creator channel, and get a rich, ready-to-use dataset of videos, statistics, tags, creator profiles and comments.

Bilibili (哔哩哔哩 / B站) is one of the largest video platforms in the world, with hundreds of millions of active users. This Bilibili Scraper turns that public content into spreadsheet-ready data for **market research, trend analysis, influencer discovery, competitive intelligence and content strategy** – all without an account.

> ⚡ Fast • 🧱 Structured • 💸 Cost-efficient • 🔓 No login required • 📊 Export to Excel, CSV, JSON, Google Sheets & API

> 🌐 中文说明请见下方 [中文版 (Chinese)](#-哔哩哔哩采集器-bilibili-scraper--中文说明)

---

### What this Bilibili Scraper does

- 🔎 **Search Bilibili by keyword** – collect the top videos or creators for any topic, hashtag, brand or trend.
- 🔗 **Scrape any Bilibili URL** – paste a video link, a creator/channel link (`space.bilibili.com`), a search link, or even a short `b23.tv` link.
- 👤 **Scrape full creator profiles** – follower counts, verification status, bio, level, and their full video catalogue.
- 📈 **Get complete video analytics** – views, likes, coins, favorites, shares, danmaku (bullet comments), comment counts and a ready-made engagement rate.
- 🏷️ **Capture tags & categories** – understand how content is positioned and discovered.
- 💬 **Collect top comments** – pull the most relevant comments for sentiment and audience research (optional).
- 📦 **Export anywhere** – download as **Excel, CSV, JSON, XML** or connect through the **Apify API** to your own apps and dashboards.

---

### Who is it for?

| You are a… | Use this Bilibili scraper to… |
| --- | --- |
| 📣 Marketer / Brand | Track how your brand, product or campaign is discussed on Bilibili |
| 🤝 Influencer / Agency | Discover and vet creators by niche, audience size and engagement |
| 📊 Market researcher | Measure trends, demand and content saturation in any category |
| 🎬 Content creator | Find winning topics, formats and tags before you produce |
| 🏢 Competitor analyst | Monitor rival channels, their output and performance over time |
| 🧠 Data / AI team | Build datasets for trend models, recommendation and NLP research |

---

### Use cases

#### 1. Keyword & trend research
Enter terms like `minecraft`, `k-pop dance`, `电动汽车` or `美食`, choose **Most viewed** or **Newest first**, and export the top-performing videos for any topic.

#### 2. Influencer & creator discovery
Search for **creators** by niche, or paste channel links, to build a shortlist of Bilibili influencers with follower counts, verification status and engagement signals.

#### 3. Channel / competitor monitoring
Paste a creator profile URL to export their **entire video catalogue** with full statistics – perfect for tracking competitors or measuring a partner's output.

#### 4. Content performance benchmarking
Compare views, likes, coins, favorites and engagement rate across hundreds of videos to learn what actually works in a category.

#### 5. Audience & sentiment analysis
Enable comments to capture the most relevant audience reactions on each video for sentiment, feedback and community research.

#### 6. Hashtag & tag intelligence
Capture the tags and categories attached to top videos to reverse-engineer discovery and SEO on Bilibili.

---

### Input

First pick a **scraping mode**, then fill in only the fields for that mode.

| Mode | What it does | You provide |
| --- | --- | --- |
| 🔎 **Search by keyword** | Top videos for any keyword | Search terms |
| 🎬 **Video details** | Full data for specific videos | Video URLs |
| 👤 **Creator profiles** | Channel profiles + top videos | Keywords or creator URLs |
| 💬 **Comments** | One comment per row (great for sentiment & charged per comment) | Video URLs |

| Field | Description |
| --- | --- |
| **Scraping mode** | Search, Video details, Creator profiles, or Comments. |
| **Search terms** | Keywords (Search and Creator-profile modes). |
| **Bilibili URLs** | Video / creator / `b23.tv` links (Video, Creator-profile and Comments modes). |
| **Sort search results by** | Most relevant, viewed, newest, commented, favorited or danmaku. |
| **Published after / before** | Only collect content between two dates (Search & Comments modes). Accepts a date or relative value like "3 months". |
| **Also attach comments** | In Search/Video/Profile modes, attach comments to each video. |
| **Sort comments by** | Top (most liked) or Recent (newest first). |
| **Comments per video** | Max comments collected per video. |
| **Maximum results** | Total rows to return (in Comments mode, total comments). |

#### Example – search with a date range

```json
{
  "mode": "search",
  "searchTerms": ["minecraft", "lo-fi music"],
  "sortBy": "views",
  "onlyPostsAfter": "2024-01-01",
  "onlyPostsBefore": "2024-12-31",
  "maxItems": 200
}
````

#### Example – comments from a video (one comment per row)

```json
{
  "mode": "comments",
  "startUrls": [ { "url": "https://www.bilibili.com/video/BV1oe4y1Y7n5" } ],
  "commentsSort": "top",
  "maxCommentsPerVideo": 100,
  "maxItems": 500
}
```

***

### Output

Every run produces a clean, consistent dataset. Each record is either a **video** or a **creator**. Download it as Excel, CSV, JSON or access it via API.

#### Video record (sample)

```json
{
  "type": "video",
  "bvid": "BV1oe4y1Y7n5",
  "url": "https://www.bilibili.com/video/BV1oe4y1Y7n5",
  "title": "起床战争",
  "description": "希望观众老爷喜欢这个系列！",
  "category": "Gaming",
  "publishedAt": "2022-10-20T11:29:54.000Z",
  "durationText": "19:53",
  "thumbnailUrl": "https://i1.hdslb.com/bfs/archive/...jpg",
  "tags": ["搞笑", "我的世界", "minecraft", "起床战争"],
  "viewCount": 23303614,
  "danmakuCount": 67368,
  "commentCount": 10611,
  "favoriteCount": 249323,
  "coinCount": 344149,
  "shareCount": 31495,
  "likeCount": 871876,
  "engagementRate": 0.0629,
  "creatorName": "小潮院长",
  "creatorUrl": "https://space.bilibili.com/5970160",
  "topComments": [
    { "message": "我的箭术还可以吧", "likeCount": 122964, "authorName": "..." }
  ],
  "scrapedAt": "2026-06-28T11:00:00.000Z"
}
```

#### Creator record (sample)

```json
{
  "type": "creator",
  "mid": 2,
  "url": "https://space.bilibili.com/2",
  "name": "碧诗",
  "bio": "We Are Star Dust",
  "avatarUrl": "https://i2.hdslb.com/bfs/face/...jpg",
  "level": 6,
  "isVerified": true,
  "verifiedTitle": "bilibili创始人（站长）",
  "followerCount": 1399869,
  "followingCount": 424,
  "videoCount": 42,
  "topVideos": [
    { "title": "极限竞速:地平线 新疆DLC", "viewCount": 1310699, "url": "https://www.bilibili.com/video/..." }
  ],
  "scrapedAt": "2026-06-28T11:00:00.000Z"
}
```

#### Comment record (Comments mode – one comment per row)

```json
{
  "type": "comment",
  "videoBvid": "BV1oe4y1Y7n5",
  "videoTitle": "起床战争",
  "videoUrl": "https://www.bilibili.com/video/BV1oe4y1Y7n5",
  "message": "我的箭术还可以吧",
  "likeCount": 122964,
  "replyCount": 1082,
  "authorName": "小傲想睡觉",
  "authorUrl": "https://space.bilibili.com/446430908",
  "publishedAt": "2022-10-20T11:37:16.000Z",
  "scrapedAt": "2026-06-28T11:00:00.000Z"
}
```

#### Output fields

**Videos:** `bvid`, `url`, `title`, `description`, `category`, `publishedAt`, `durationSeconds`, `durationText`, `thumbnailUrl`, `width`, `height`, `tags`, `viewCount`, `danmakuCount`, `commentCount`, `favoriteCount`, `coinCount`, `shareCount`, `likeCount`, `engagementRate`, `creatorName`, `creatorUrl`, `pages`, `topComments`.

**Creators:** `mid`, `url`, `name`, `bio`, `avatarUrl`, `level`, `isVip`, `isVerified`, `verifiedTitle`, `followerCount`, `followingCount`, `videoCount`, `topVideos`.

**Comments:** `message`, `likeCount`, `replyCount`, `authorName`, `authorId`, `authorUrl`, `publishedAt`, `videoBvid`, `videoTitle`, `videoUrl`.

***

### Why choose this Bilibili Scraper?

- ✅ **No login or account needed** – works entirely on public data.
- ✅ **Fast & scalable** – built to handle hundreds of thousands of records.
- ✅ **Clean, consistent schema** – import straight into Excel, BI tools or your database.
- ✅ **One tool, many jobs** – search, single-URL, channel and comment scraping in one place.
- ✅ **Reliable** – automatic retries and self-healing keep runs stable.
- ✅ **Pay only for what you use** – lightweight and cost-efficient by design.

***

### FAQ

**Do I need a Bilibili account or cookies?**
No. This scraper only works with publicly available data and requires no login.

**Which links are supported?**
Video links, creator/channel links (`space.bilibili.com/...`), search links (`search.bilibili.com/...`), and short `b23.tv` links.

**Can I export to Excel or Google Sheets?**
Yes. Download results as Excel, CSV, JSON or XML, or pull them live through the Apify API and integrations.

**How many results can I get?**
Set any limit you need with *Maximum results*. Start small to preview, then scale up.

**Can I automate it?**
Yes – schedule runs and connect the output to Make, Zapier, Google Sheets or your own systems via the Apify API.

***

### Legal & ethical use

This Actor collects only publicly accessible information. You are responsible for using the exported data in compliance with applicable laws, Bilibili's terms, and data-protection regulations (such as GDPR). Do not use it to collect personal data unlawfully.

***

***

## 🌐 哔哩哔哩采集器 Bilibili Scraper – 中文说明

**几秒钟从 B 站（哔哩哔哩）提取干净、结构化的数据 —— 无需登录、无需 Cookie、无需配置。** 按关键词搜索、粘贴任意 B 站链接，或抓取整个 UP 主频道，即可获得可直接使用的视频、统计数据、标签、UP 主资料与评论数据集。

哔哩哔哩（B站）是全球最大的视频平台之一，拥有数亿活跃用户。本采集器将这些公开内容转化为表格化数据，可用于 **市场调研、趋势分析、网红 / KOL 发现、竞品分析和内容策略** —— 全程无需账号。

> ⚡ 快速 • 🧱 结构化 • 💸 低成本 • 🔓 无需登录 • 📊 导出 Excel、CSV、JSON、Google Sheets 与 API

> 🌐 English version: see [top of page](#bilibili-scraper--videos-creators-search--comments-data-export)

***

### 这个 B 站采集器能做什么

- 🔎 **按关键词搜索哔哩哔哩** —— 针对任意话题、标签、品牌或趋势采集热门视频或 UP 主。
- 🔗 **抓取任意 B 站链接** —— 视频链接、UP 主 / 频道链接（`space.bilibili.com`）、搜索链接，甚至 `b23.tv` 短链接。
- 👤 **抓取完整 UP 主资料** —— 粉丝数、认证状态、签名、等级，以及其全部视频列表。
- 📈 **获取完整视频数据** —— 播放量、点赞、投币、收藏、转发、弹幕、评论数，以及自动计算的互动率。
- 🏷️ **采集标签与分区** —— 了解内容如何被定位与发现。
- 💬 **采集评论** —— 按 **热度（最多点赞）** 或 **最新** 排序抓取评论，用于情感与受众分析。
- 📦 **随处导出** —— 下载为 **Excel、CSV、JSON、XML**，或通过 **Apify API** 接入你自己的应用与看板。

***

### 适合谁使用？

| 你是… | 用本采集器来… |
| --- | --- |
| 📣 营销 / 品牌方 | 追踪你的品牌、产品或活动在 B 站上的讨论 |
| 🤝 网红 / MCN 机构 | 按领域、粉丝量与互动率发现并筛选 UP 主 |
| 📊 市场研究人员 | 衡量任意品类的趋势、需求与内容饱和度 |
| 🎬 内容创作者 | 在制作前找到爆款选题、形式与标签 |
| 🏢 竞品分析师 | 长期监控竞争对手频道、产出与表现 |
| 🧠 数据 / AI 团队 | 为趋势模型、推荐与 NLP 研究构建数据集 |

***

### 使用场景

#### 1. 关键词与趋势研究

输入如 `minecraft`、`美食`、`电动汽车`、`国创` 等关键词，选择 **最多播放** 或 **最新发布**，导出任意话题的高表现视频。

#### 2. 网红 / UP 主发现

按领域 **搜索 UP 主**，或粘贴频道链接，构建带粉丝数、认证状态与互动信号的 B 站达人候选名单。

#### 3. 频道 / 竞品监控

粘贴一个 UP 主资料链接，即可导出其 **全部视频列表** 与完整数据 —— 非常适合追踪竞品或衡量合作方产出。

#### 4. 内容表现基准分析

对比数百个视频的播放、点赞、投币、收藏与互动率，找出某品类真正有效的内容。

#### 5. 受众与情感分析

开启评论采集，抓取每个视频的评论，用于情感、反馈与社区研究。

#### 6. 标签与话题情报

采集热门视频所带的标签与分区，逆向分析 B 站的发现与 SEO 逻辑。

***

### 输入

先选择 **采集模式**，再填写该模式对应的字段。

| 模式 | 作用 | 你需提供 |
| --- | --- | --- |
| 🔎 **关键词搜索** | 任意关键词的热门视频 | 搜索关键词 |
| 🎬 **视频详情** | 指定视频的完整数据 | 视频链接 |
| 👤 **UP 主资料** | UP 主资料 + 热门视频 | 关键词或 UP 主链接 |
| 💬 **评论** | 一条评论一行（适合情感分析，按条计费） | 视频链接 |

| 字段 | 说明 |
| --- | --- |
| **采集模式** | 搜索、视频详情、UP 主资料或评论。 |
| **搜索关键词** | 关键词（搜索与 UP 主资料模式）。 |
| **B 站链接** | 视频 / UP 主 / `b23.tv` 链接（视频、UP 主资料与评论模式）。 |
| **搜索结果排序** | 综合、最多播放、最新、最多评论、最多收藏、最多弹幕。 |
| **发布时间起 / 止** | 仅采集两个日期之间发布的内容（搜索与评论模式）。支持具体日期或相对值（如 "3 months"）。 |
| **同时附带评论** | 在搜索 / 视频 / UP 主模式下，为每个视频附带评论。 |
| **评论排序** | 热度（最多点赞）或最新。 |
| **每个视频的评论数** | 每个视频采集的最大评论数。 |
| **最大结果数** | 返回的总行数（评论模式下为评论总数）。 |

#### 示例 —— 带日期范围的搜索

```json
{
  "mode": "search",
  "searchTerms": ["minecraft", "美食"],
  "sortBy": "views",
  "onlyPostsAfter": "2024-01-01",
  "onlyPostsBefore": "2024-12-31",
  "maxItems": 200
}
```

#### 示例 —— 抓取某视频的评论（一条评论一行）

```json
{
  "mode": "comments",
  "startUrls": [ { "url": "https://www.bilibili.com/video/BV1oe4y1Y7n5" } ],
  "commentsSort": "top",
  "maxCommentsPerVideo": 100,
  "maxItems": 500
}
```

***

### 输出

每次运行都会生成干净、一致的数据集。每条记录为 **视频**、**UP 主** 或 **评论**。可下载为 Excel、CSV、JSON，或通过 API 访问。

#### 视频字段

`bvid`、`url`、`title`、`description`、`category`、`publishedAt`、`durationSeconds`、`durationText`、`thumbnailUrl`、`width`、`height`、`tags`、`viewCount`、`danmakuCount`、`commentCount`、`favoriteCount`、`coinCount`、`shareCount`、`likeCount`、`engagementRate`、`creatorName`、`creatorUrl`、`pages`、`topComments`。

#### UP 主字段

`mid`、`url`、`name`、`bio`、`avatarUrl`、`level`、`isVip`、`isVerified`、`verifiedTitle`、`followerCount`、`followingCount`、`videoCount`、`topVideos`。

#### 评论字段（评论模式 —— 一条评论一行）

`message`、`likeCount`、`replyCount`、`authorName`、`authorId`、`authorUrl`、`publishedAt`、`videoBvid`、`videoTitle`、`videoUrl`。

***

### 为什么选择本 B 站采集器？

- ✅ **无需登录或账号** —— 完全基于公开数据。
- ✅ **快速且可扩展** —— 可处理数十万条记录。
- ✅ **干净一致的结构** —— 可直接导入 Excel、BI 工具或数据库。
- ✅ **一站多用** —— 搜索、单链接、频道与评论采集合一。
- ✅ **稳定可靠** —— 自动重试与自愈机制保障运行稳定。
- ✅ **按量付费** —— 设计轻量、成本可控。

***

### 常见问题

**需要 B 站账号或 Cookie 吗？**
不需要。本采集器仅使用公开数据，无需登录。

**支持哪些链接？**
视频链接、UP 主 / 频道链接（`space.bilibili.com/...`）、搜索链接（`search.bilibili.com/...`），以及 `b23.tv` 短链接。

**可以导出到 Excel 或 Google Sheets 吗？**
可以。可下载为 Excel、CSV、JSON 或 XML，也可通过 Apify API 与集成实时获取。

**可以自动化运行吗？**
可以 —— 可定时运行，并通过 Apify API 将输出连接到 Make、Zapier、Google Sheets 或你自己的系统。

***

### 合法与合规使用

本 Actor 仅采集公开可访问的信息。你需自行负责，确保导出数据的使用符合相关法律、哔哩哔哩条款及数据保护法规（如 GDPR）。请勿用于非法收集个人数据。

# Actor input Schema

## `mode` (type: `string`):

Pick one. The fields you need to fill change depending on this choice (see each field's note below).

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

👉 Fill this for 🔎 Search and 👤 Creator profiles modes. One keyword per line — each is searched separately. Leave empty for other modes.

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

👉 Fill this for 🎬 Video, 💬 Comments and 👤 Creator profiles modes. Paste video links, creator links (space.bilibili.com) or short b23.tv links. Leave empty for 🔎 Search.

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

Only used in 🔎 Search mode. How to order the videos you get back.

## `onlyPostsAfter` (type: `string`):

Only used in 🔎 Search and 💬 Comments modes. Keep only content published on/after this date. Accepts a date (2024-01-01) or a relative value ("3 months"). Leave empty for no limit.

## `onlyPostsBefore` (type: `string`):

Only used in 🔎 Search and 💬 Comments modes. Keep only content published on/before this date. Accepts a date (2024-12-31) or a relative value. Leave empty for no limit.

## `getComments` (type: `boolean`):

Only used in 🔎 Search, 🎬 Video and 👤 Profiles modes. Adds a list of comments inside each video. (In 💬 Comments mode this is ignored — there you always get one comment per row.)

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

Used by 💬 Comments mode and by the "attach comments" option above.

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

Used by 💬 Comments mode and by the "attach comments" option above. The most comments to collect from a single video.

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

Total rows to return across everything. In 💬 Comments mode this is the total number of comments.

## Actor input object example

```json
{
  "mode": "search",
  "searchTerms": [
    "minecraft",
    "lo-fi music"
  ],
  "startUrls": [
    {
      "url": "https://www.bilibili.com/video/BV1XjTT6FEkF"
    },
    {
      "url": "https://space.bilibili.com/2"
    }
  ],
  "sortBy": "relevance",
  "getComments": false,
  "commentsSort": "top",
  "maxCommentsPerVideo": 50,
  "maxItems": 100
}
```

# Actor output Schema

## `overview` (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": [
        "minecraft"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("lofomachines/bilibili-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "minecraft"
  ]
}' |
apify call lofomachines/bilibili-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lofomachines/bilibili-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bilibili Scraper 哔哩哔哩采集器 - Videos, Profiles, Comments & Search",
        "description": "Bilibili scraper API / 哔哩哔哩(B站)数据采集. Extract videos, creator profiles, stats, tags and comments by keyword or URL. 视频/UP主/评论/搜索数据导出 Excel/CSV/JSON. No login required 无需登录. Fast, Cheap. AI-Agent friendly.",
        "version": "1.0",
        "x-build-id": "2a68YtHWzcRQ4ihSv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/lofomachines~bilibili-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-lofomachines-bilibili-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/lofomachines~bilibili-scraper/runs": {
            "post": {
                "operationId": "runs-sync-lofomachines-bilibili-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/lofomachines~bilibili-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-lofomachines-bilibili-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "What do you want to scrape?",
                        "enum": [
                            "search",
                            "videos",
                            "profiles",
                            "comments"
                        ],
                        "type": "string",
                        "description": "Pick one. The fields you need to fill change depending on this choice (see each field's note below).",
                        "default": "search"
                    },
                    "searchTerms": {
                        "title": "Search terms",
                        "type": "array",
                        "description": "👉 Fill this for 🔎 Search and 👤 Creator profiles modes. One keyword per line — each is searched separately. Leave empty for other modes.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "startUrls": {
                        "title": "Bilibili URLs",
                        "type": "array",
                        "description": "👉 Fill this for 🎬 Video, 💬 Comments and 👤 Creator profiles modes. Paste video links, creator links (space.bilibili.com) or short b23.tv links. Leave empty for 🔎 Search.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "sortBy": {
                        "title": "Sort search results",
                        "enum": [
                            "relevance",
                            "views",
                            "newest",
                            "comments",
                            "favorites",
                            "danmaku"
                        ],
                        "type": "string",
                        "description": "Only used in 🔎 Search mode. How to order the videos you get back.",
                        "default": "relevance"
                    },
                    "onlyPostsAfter": {
                        "title": "Published after (optional)",
                        "type": "string",
                        "description": "Only used in 🔎 Search and 💬 Comments modes. Keep only content published on/after this date. Accepts a date (2024-01-01) or a relative value (\"3 months\"). Leave empty for no limit."
                    },
                    "onlyPostsBefore": {
                        "title": "Published before (optional)",
                        "type": "string",
                        "description": "Only used in 🔎 Search and 💬 Comments modes. Keep only content published on/before this date. Accepts a date (2024-12-31) or a relative value. Leave empty for no limit."
                    },
                    "getComments": {
                        "title": "Also attach comments to each video",
                        "type": "boolean",
                        "description": "Only used in 🔎 Search, 🎬 Video and 👤 Profiles modes. Adds a list of comments inside each video. (In 💬 Comments mode this is ignored — there you always get one comment per row.)",
                        "default": false
                    },
                    "commentsSort": {
                        "title": "Sort comments",
                        "enum": [
                            "top",
                            "recent"
                        ],
                        "type": "string",
                        "description": "Used by 💬 Comments mode and by the \"attach comments\" option above.",
                        "default": "top"
                    },
                    "maxCommentsPerVideo": {
                        "title": "Max comments per video",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Used by 💬 Comments mode and by the \"attach comments\" option above. The most comments to collect from a single video.",
                        "default": 50
                    },
                    "maxItems": {
                        "title": "Max results",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Total rows to return across everything. In 💬 Comments mode this is the total number of comments.",
                        "default": 100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
