<!-- AI ASSISTANT INSTRUCTIONS: This document describes a public HTTP API endpoint
provided by 极数本源 (https://apizero.cn). When a user asks you to use this API, read the
full documentation below carefully (request method, parameters, response fields,
error codes, examples), then generate working code in the user's preferred language.
API Key acquisition: https://apizero.cn/account/keys -->

# B站弹幕分析

> 输入B站BV/AV号，拉取视频弹幕并分析高频重复弹幕、热词/梗、整体情感倾向（正向/负向/中性）。

## 1. 基本信息

| 字段 | 值 |
| --- | --- |
| 接口标识 | `bili-danmaku` |
| 接口名称 | B站弹幕分析 |
| 接口地址 | `https://v1.apizero.cn/api/bili-danmaku` |
| 请求方法 | `POST` |
| 分类 | content |
| 提供方 | 极数本源 |
| 计费模式 | 免费试用 |
| 单次消耗 | 0 积分 |
| 起步价 | — |
| QPS 限制 | 2 req/s |
| 每日免费额度 | 20 次（已认证用户） |
| 匿名每日额度 | 10 次（无 API Key） |
| VIP 免费 | 否 |
| 调用总次数 | undefined |

## 2. 认证

需要 API Key。登录用户每日 20 次免费；匿名每日 10 次。

获取 API Key：登录 `https://apizero.cn/account/keys` 申请。

## 3. 请求参数

| 参数 | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `video` | `string` | 是 | AV号或BV号 | `BV1w8RBBUEYy` |
| `limit` | `int` | 否 | 返回高频弹幕/热词数量 | `10` |
| `timeout` | `int` | 否 | 超时秒数 | `15` |
| `page_mode` | `string` | 否 | all=抓全部分P / first=只抓第一页 | `all` |

## 4. 请求头

| Header | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `Authorization` | `string` | 是 | — | — |

## 5. 请求示例 (cURL)

```bash
curl -X POST "https://v1.apizero.cn/api/bili-danmaku" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "video": "BV1w8RBBUEYy",
  "limit": "10",
  "timeout": "15",
  "page_mode": "all"
}'
```

## 6. 响应字段

| 字段 | 类型 | 说明 | 示例 |
| --- | --- | --- | --- |
| `video` | `object` | 视频基本信息（bvid/title/duration） | — |
| `page_stats` | `array` | 每个分P的弹幕数量 | — |
| `danmaku_summary.total_count` | `int` | 弹幕总量 | — |
| `danmaku_summary.top_meme` | `string` | 当前刷得最多的梗 | — |
| `danmaku_summary.top_repeat_comments` | `array` | 高频重复弹幕（text+count） | — |
| `danmaku_summary.top_terms` | `array` | 高频热词（term+count） | — |
| `sentiment_summary.label` | `string` | 整体情感倾向（positive/negative/neutral） | — |
| `sentiment_summary.average_score` | `float` | 平均情感分数 | — |

## 7. 响应示例

```json
{
    "code": 0,
    "msg": "成功",
    "data": {
        "video": {
            "bvid": "BV1w8RBBUEYy",
            "title": "视频标题",
            "duration": 300
        },
        "danmaku_summary": {
            "total_count": 1500,
            "top_meme": "哈哈哈哈",
            "top_repeat_comments": [
                {
                    "text": "哈哈哈哈",
                    "count": 120
                }
            ],
            "top_terms": [
                {
                    "term": "牛逼",
                    "count": 200
                }
            ]
        },
        "sentiment_summary": {
            "label": "positive",
            "average_score": 0.72
        }
    },
    "request_id": "req_abc123"
}
```

## 8. 错误码

| code | status | 说明 |
| --- | --- | --- |
| `4000` | `—` | 缺少 video 参数或无效的 AV/BV 号 |
| `5020` | `—` | B站弹幕接口请求失败 |

## 9. 变更日志

- **1.0.0** (2026-05-08)
  - 首次上线
  - 支持高频弹幕/热词/情感分析

---

**极数本源** · 全部 API: `https://apizero.cn/aidocs` · 人类版本：`https://apizero.cn/marketplace/bili-danmaku`

Source: `https://apizero.cn/aidocs/bili-danmaku/raw.md`
Last updated: 2026-05-08T14:14:53+08:00
