B站视频评论怎么按 BV 号获取
传 BV 号,用 data.next 翻页,它会把页码加一。10 页约 180 条评论,10 次调用、$0.02,不用算 wbi 签名,也不会碰到 412。
更新于 2026-11-22·本页 Markdown
翻完全部评论
bv_id 填 bilibili.com/video 链接里 BV 开头那段。按页码翻页:data.next 是 {"pn": 2},接着是 3,一直到它为 null。
B站视频评论·GET /v1/bilibili/comments/list·$0.002 / 次
curl "https://xtikapi.com/v1/bilibili/comments/list?bv_id=BV1zGy5ziEnd" \
-H "Authorization: Bearer YOUR_API_KEY"import requests
URL = "https://xtikapi.com/v1/bilibili/comments/list"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"bv_id": "BV1zGy5ziEnd"}
items = []
for _ in range(10): # one call per page
for attempt in range(3): # 5xx errors are not charged: retry
response = requests.get(URL, params=params, headers=HEADERS, timeout=60)
if response.status_code < 500:
break
response.raise_for_status()
data = response.json()["data"]
items += data["items"]
if not data.get("next"): # null on the last page
break
params.update(data["next"])
print(len(items), "items")const URL = "https://xtikapi.com/v1/bilibili/comments/list";
const HEADERS = { Authorization: "Bearer YOUR_API_KEY" };
let params = {"bv_id":"BV1zGy5ziEnd"};
const items = [];
for (let page = 0; page < 10; page++) {
let response;
for (let attempt = 0; attempt < 3; attempt++) {
// 5xx errors are not charged: retry
response = await fetch(`${URL}?${new URLSearchParams(params)}`, { headers: HEADERS });
if (response.status < 500) break;
}
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { data } = await response.json();
items.push(...data.items);
if (!data.next) break; // null on the last page
params = { ...params, ...data.next };
}
console.log(items.length, "items");录制的真实返回(列表只保留前两条)
{
"data": {
"items": [
{
"id": "627037004863",
"text": "Example text",
"author": {
"id": "691389870",
"name": "Example name",
"avatar": "https://example.com/image.jpg",
"description": "Example text"
},
"createdAt": "2026-11-18T18:21:51.000Z",
"likeCount": 72,
"replyCount": 7
},
{
"id": "627020641159",
"text": "Example text",
"author": {
"id": "6467168760735863",
"name": "Example name",
"avatar": "https://example.com/image.jpg"
},
"createdAt": "2026-11-18T14:20:14.000Z",
"likeCount": 21,
"replyCount": 13
}
],
"has_more": true,
"next": {
"pn": 2
}
},
"meta": {
"request_id": "example",
"endpoint": "bilibili.comments.list",
"normalized": true,
"unavailable": [],
"billing": {
"charged": true,
"amount": 0.002,
"balance": 4.98
}
}
}这个例子花多少钱
合计
调用次数:10
单价:—
小计:$0.02
失败和超时不收费。验证过邮箱的新账号送 $0.50 试用额度,够跑完这个例子。
要注意的地方
- 2026-11-22 实测第一页 3 条或 20 条,之后每页 20 条;10 页共拿到 183 条。
- B站偶尔会在还有评论的时候返回空页。网关会自动重试,还不行就返回一个可重试、不扣费的错误,上面的代码会再试一次。
- 以
data.next为 null 作为结束,不要看到短页就停。 - 回复用
bilibili.comment_replies.list取。弹幕不在返回里。
用到的接口
- B站视频评论 · $0.002 / 次
B站的更多内容
常见问题
用 XTikAPI 做这件事要花多少钱?
按本文的例子是 10 次调用,共 $0.02。失败和超时不收费;验证过邮箱的新账号送 $0.50 试用额度。
能传 av 号吗?
这个接口要 BV 号。旧的 av 链接在 B站会跳到 BV 链接,用跳转后链接里的 BV 号。