get_comments
Fetches top-level comments for a Bilibili video, excluding replies, with hot or newest sorting and cursor-based pagination; login is required.
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 是其长度。hot 下若还要续取,不要用 jq 截取条数(如 .[:N]):续取从整批之后开始,截掉的评论取不回。 | |
| url | Yes | 视频链接、b23.tv 短链,或裸 BV/av 号;含链接的分享文案也可直接传入。 | |
| mode | No | 排序方式:hot 是平台的综合排序。hot 的 cursor 只标识浏览会话,进度记在平台侧,同一 cursor 每次调用都返回下一批,不能重放某一批;同一视频同一时间只用一个 hot cursor:新开会话后,旧 cursor 只会返回已取过的内容,新旧混用时两者都会回退。newest 按时间倒序,cursor 含位置,可重复取同一批,不受新会话影响。需要完整抓取或断点续取时用 newest。newest 的结果缓存 30 分钟,cached_at 是缓存的抓取时间。 | hot |
| count | Yes | 至少取多少条主评论。平台按每页约 20 条整页返回,实际条数约为 20 的整数倍;评论不够时返回剩余的全部。 | |
| cursor | No | 续取游标:不传从头开始,回传上次返回的 next_cursor 取下一批。 |
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 | ||
| next_cursor | No |