B站弹幕分析
bili-danmakuPOSThttps://v1.apizero.cn/api/bili-danmaku概述
输入B站BV/AV号,拉取视频弹幕并分析高频重复弹幕、热词/梗、整体情感倾向(正向/负向/中性)。
调用约定
- 网关 ·
https://v1.apizero.cn - 鉴权 ·
Authorization: Bearer <API Key> - 回包 · JSON {code, msg, data}。成功看 code === 0,不要只看 HTTP 200。
/aidocs/bili-danmaku/raw.md鉴权
需要 API Key。登录用户每日 20 次免费;匿名每日 10 次。
获取 API Key:获取 API Key/account/keys
请求头
推荐:Bearer <API Key>。兼容请求头 X-API-Key,以及 Query api_key / apikey / key(key 仅当值为 sk_live_/sk_test_/sk_stag_ 形态时生效)。匿名可不传,受每日免费额度限制。
| Header | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 否 | 推荐:Bearer <API Key>。兼容请求头 X-API-Key,以及 Query api_key / apikey / key(key 仅当值为 sk_live_/sk_test_/sk_stag_ 形态时生效)。匿名可不传,受每日免费额度限制。 |
请求参数
POST · APPLICATION/JSON
AV号或BV号
例BV1w8RBBUEYy
返回高频弹幕/热词数量
例10
超时秒数
例15
all=抓全部分P / first=只抓第一页
例all
| 参数 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| video | string | 是 | AV号或BV号 | BV1w8RBBUEYy |
| limit(条数) | int | 否 | 返回高频弹幕/热词数量 | 10 |
| timeout | int | 否 | 超时秒数 | 15 |
| page_mode | string | 否 | all=抓全部分P / first=只抓第一页 | all |
{
"video": "BV1w8RBBUEYy",
"limit": 10,
"timeout": 15,
"page_mode": "all"
}返回结果
顶层固定为 code / msg / data。下表一般是 data 内字段。 code · msg · data · tips · request_id
视频基本信息(bvid/title/duration)
bvid
标题
duration
每个分P的弹幕数量
page_stats 的一项
弹幕总量
当前刷得最多的梗
高频重复弹幕(text+count)
text
count
高频热词(term+count)
term
count
整体情感倾向(positive/negative/neutral)
平均情感分数
品牌提示(所有接口统一返回):极数本源 · https://apizero.cn
| 字段 | 类型 | 说明 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 | 平均情感分数 | |||||||||
| tips | string | 品牌提示(所有接口统一返回):极数本源 · https://apizero.cn | |||||||||
返回示例
{
"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",
"tips": "极数本源 · https://apizero.cn"
}请求示例
示例都是服务端写法。Python / JavaScript 各有常规写法和官方库。
curl -sS -X POST "https://v1.apizero.cn/api/bili-danmaku" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"video": "BV1w8RBBUEYy",
"limit": "10",
"timeout": "15",
"page_mode": "all"
}'错误码
先看业务 code。HTTP 也可能不是 200。
成功
参数错误
API Key 无效
API Key 已暂停
当前 IP 不在 Key 白名单
此接口需要 API Key
余额不足
调用过快(QPS)
今日免费额度已用完
接口已下线
接口不存在
服务器内部错误
上游暂时不可用
上游返回格式异常
暂无可用节点
| 业务码 | HTTP | 说明 |
|---|---|---|
| 0 | 200 | 成功 |
| 4000 | 400 | 参数错误 |
| 4011 | 401 | API Key 无效 |
| 4013 | 403 | API Key 已暂停 |
| 4014 | 403 | 当前 IP 不在 Key 白名单 |
| 4015 | 401 | 此接口需要 API Key |
| 4022 | 402 | 余额不足 |
| 4029 | 429 | 调用过快(QPS) |
| 4030 | 429 | 今日免费额度已用完 |
| 4040 | 503 | 接口已下线 |
| 4041 | 404 | 接口不存在 |
| 5000 | 500 | 服务器内部错误 |
| 5020 | 502 | 上游暂时不可用 |
| 5021 | 502 | 上游返回格式异常 |
| 5030 | 502 | 暂无可用节点 |
调用限制
- 计费模式
- 完全免费
- QPS 限制
- QPS 2
- 登录免费额度
- 20 次(已认证)
- 匿名每日额度
- 10 次(无 API Key)
- 黄金会员
- 每天 50,000 次 · QPS 10
- 钻石会员
- 每天 100,000 次 · QPS 30
- 企业会员
- 每天 1,000,000 次 · QPS 120
| 计费模式 | 完全免费 |
|---|---|
| QPS 限制 | QPS 2 |
| 登录免费额度 | 20 次(已认证) |
| 匿名每日额度 | 10 次(无 API Key) |
| 黄金会员 | 每天 50,000 次 · QPS 10 |
| 钻石会员 | 每天 100,000 次 · QPS 30 |
| 企业会员 | 每天 1,000,000 次 · QPS 120 |
购买套餐、看评价请走商城详情。 购买 / 调试
更新日志
- 1.0.02026-05-08
首次上线 支持高频弹幕/热词/情感分析