get_comments
Fetch top-level comments from Bilibili videos, sorted by hot or newest, with cursor-based pagination. Supports jq filtering for specific fields.
Instructions
不含二级评论,二级评论通过 get_comment_replies 获取。
image_urls、link_titles 是字符串,多个时以换行分隔。
(video comments)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jq | Yes | 必填的 jq 表达式。输入是本批条目组成的数组,每条字段:id,author,author_url,author_level,is_up,ip_location,content,like_count,reply_count,parent_id,created_at,is_top,up_liked,image_urls,link_titles。体积大、多数任务用不到的字段:author_url(查看评论者资料时需要)、is_up、created_at、is_top、up_liked;特定任务需要时照常使用。分页字段不在输入里;只筛本批,筛完为空时仍以 has_more 判断有无下一批。结果为字符串时原样返回,其他结果编码为表格或 JSON;结果为数组时 jq_count 是其长度。 | |
| mode | No | 排序方式:hot 是平台的综合排序。hot 的 cursor 只标识浏览会话,进度记在平台侧,翻页与重放靠 batch_id;同一视频同一时间只用一个 hot cursor:新开会话(包括其他对话里的)后,旧 cursor 会重复取过的内容或提前返回空,混用时新的也会回退;遇到时从 cursor 为空重新开始。newest 按时间倒序,cursor 含位置,可重复取同一批,不受新会话影响。需要完整抓取或断点续取时用 newest。缓存:除 jq 外参数相同的调用返回同一结果,from_cache 表示是否来自缓存;被限速的不完整结果不缓存。newest 要新数据用 refresh,hot 换 batch_id 取下一批。调用没收到结果时服务端仍会取完,之后用相同参数再取直接用缓存。 | hot |
| count | Yes | 至少取多少条主评论。平台按每页约 20 条整页返回,实际条数可能多于 count;评论不够时返回剩余的全部。主评论与二级评论合计每分钟约取 30 页(约 600 条),取得多则耗时长,可以分几次取。 | |
| video | Yes | 视频链接、b23.tv 短链,或裸 BV/av 号;含链接的分享文案也可直接传入。 | |
| cursor | No | 续取游标:不传从头开始,回传上次返回的 next_cursor 取下一批。 | |
| refresh | No | 跳过缓存重新取,并更新缓存。仅用于 newest。 | |
| batch_id | No | mode=hot 时必填。自定的短字符串:其他参数相同时,同一个值返回同一批,换新值取下一批。重放结果与之前不同时,原批次已丢失,需要就从 cursor 为空重新开始。 | |
| description | Yes | 格式为 工具名:目的。 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | ||
| message | No | ||
| comments | Yes | ||
| has_more | Yes | ||
| jq_count | No | ||
| video_id | Yes | ||
| cached_at | No | ||
| elapsed_s | No | ||
| from_cache | No | ||
| next_cursor | No |