Skip to content

Pixiv Web API - Comment ​

源文件 apis/comment-web.yaml · Base URL https://www.pixiv.net

Pixiv Web 站(www.pixiv.net)评论(comment)相关的 AJAX / RPC 接口, 完整收录开源实现中出现的全部端点: 插画/小说的根评论与回复列表,以及旧版 rpc 的评论发表/删除。

鉴权(Cookie)、响应信封({error, message, body})、写操作的 x-csrf-token 与通用 lang 参数见 _shared.yaml 的 Web API 约定。

接口目录 ​

接口 ​

GET /ajax/illusts/comments/roots ​

插画的根评论列表(Web 版)

网页版作品页的评论主列表(limit/offset 翻页), 每条评论带回复数,楼中楼用 replies 端点拉取。 与 App API 的 /v1/illust/comments 能力对应。

operationId webIllustCommentRoots · 标签 comment-web

认证:无需认证

请求参数 ​

参数位置类型必填说明
illust_idqueryinteger✓作品 ID
limitqueryinteger✓每页数量
offsetqueryinteger✓偏移量

响应 ​

状态码说明结构
200根评论列表object

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)
bodyobject
body.commentsobject[]评论(含 id、comment、date、user、hasReplies 等,字段以实际响应为准)

GET /ajax/illusts/comments/replies ​

插画评论的回复列表(楼中楼)

某条根评论下的回复,page 从 0 开始翻页。

operationId webIllustCommentReplies · 标签 comment-web

认证:无需认证

请求参数 ​

参数位置类型必填说明
comment_idqueryinteger✓根评论 ID
pagequeryinteger✓页码,从 0 开始

响应 ​

状态码说明结构
200回复列表object

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)
bodyobject
body.commentsobject[]

GET /ajax/novels/comments/roots ​

小说的根评论列表(Web 版)

网页版小说页的评论主列表。与 App API 的 /v1/novel/comments 能力对应。

operationId webNovelCommentRoots · 标签 comment-web

认证:无需认证

请求参数 ​

参数位置类型必填说明
novel_idqueryinteger✓小说 ID
limitqueryinteger✓每页数量
offsetqueryinteger✓偏移量

响应 ​

状态码说明结构
200根评论列表object

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)
bodyobject
body.commentsobject[]

GET /ajax/novels/comments/replies ​

小说评论的回复列表(楼中楼)

某条根评论下的回复,page 从 0 开始翻页。

operationId webNovelCommentReplies · 标签 comment-web

认证:无需认证

请求参数 ​

参数位置类型必填说明
comment_idqueryinteger✓根评论 ID
pagequeryinteger✓页码,从 0 开始

响应 ​

状态码说明结构
200回复列表object

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)
bodyobject
body.commentsobject[]

POST /rpc/post_comment.php ​

发表插画评论(Web rpc)

网页版评论写操作,效果同 App API 的 POST /v1/illust/comment/add。 需要登录 Cookie 与 CSRF token。

operationId webRpcPostIllustComment · 标签 comment-web-write

认证:cookieAuth — Web API(www.pixiv.net AJAX / RPC)使用的浏览器会话 Cookie (如 PHPSESSID=12345678_abCdEf...),登录后获得, 以 Cookie 请求头携带。

请求参数 ​

参数位置类型必填说明
x-csrf-tokenheaderstring✓CSRF token(取自会话 Cookie 中的 CSRFTOKEN,或页面返回的 token),Web 写操作必带

请求体(application/x-www-form-urlencoded,必填) ​

字段类型必填说明
typestring评论类型(stamp=表情贴纸);默认 comment;可选值 comment / stamp
illust_idinteger✓插画 ID
author_user_idinteger✓作品作者的用户 ID
commentstring✓评论内容(type=stamp 时为贴纸 ID)

响应 ​

状态码说明结构
200发表结果(error=false 表示成功)WebApiEnvelope
400参数缺失或 CSRF token 无效WebApiEnvelope
401未登录WebApiEnvelope

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)

POST /rpc_delete_comment.php ​

删除插画评论(Web rpc)

删除自己发表的(或自己作品下的)插画评论。 与 App API 的 /POST /v1/illust/comment/delete 能力对应。 需要登录 Cookie 与 CSRF token。

operationId webRpcDeleteIllustComment · 标签 comment-web-write

认证:cookieAuth — Web API(www.pixiv.net AJAX / RPC)使用的浏览器会话 Cookie (如 PHPSESSID=12345678_abCdEf...),登录后获得, 以 Cookie 请求头携带。

请求参数 ​

参数位置类型必填说明
x-csrf-tokenheaderstring✓CSRF token(取自会话 Cookie 中的 CSRFTOKEN,或页面返回的 token),Web 写操作必带

请求体(application/x-www-form-urlencoded,必填) ​

字段类型必填说明
i_idinteger✓作品 ID
del_idinteger✓要删除的评论 ID

响应 ​

状态码说明结构
200删除结果(error=false 表示成功)WebApiEnvelope
401未登录WebApiEnvelope

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)

POST /novel/rpc/post_comment.php ​

发表小说评论(Web rpc)

网页版小说评论写操作,效果同 App API 的 POST /v1/novel/comment/add。 需要登录 Cookie 与 CSRF token。

operationId webRpcPostNovelComment · 标签 comment-web-write

认证:cookieAuth — Web API(www.pixiv.net AJAX / RPC)使用的浏览器会话 Cookie (如 PHPSESSID=12345678_abCdEf...),登录后获得, 以 Cookie 请求头携带。

请求参数 ​

参数位置类型必填说明
x-csrf-tokenheaderstring✓CSRF token(取自会话 Cookie 中的 CSRFTOKEN,或页面返回的 token),Web 写操作必带

请求体(application/x-www-form-urlencoded,必填) ​

字段类型必填说明
typestring评论类型(stamp=表情贴纸);默认 comment;可选值 comment / stamp
novel_idinteger✓小说 ID
author_user_idinteger✓作品作者的用户 ID
commentstring✓评论内容(type=stamp 时为贴纸 ID)

响应 ​

状态码说明结构
200发表结果(error=false 表示成功)WebApiEnvelope
400参数缺失或 CSRF token 无效WebApiEnvelope
401未登录WebApiEnvelope

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)

POST /novel/rpc_delete_comment.php ​

删除小说评论(Web rpc)

删除自己发表的(或自己小说下的)评论。 与 App API 的 POST /v1/novel/comment/delete 能力对应。 需要登录 Cookie 与 CSRF token。

operationId webRpcDeleteNovelComment · 标签 comment-web-write

认证:cookieAuth — Web API(www.pixiv.net AJAX / RPC)使用的浏览器会话 Cookie (如 PHPSESSID=12345678_abCdEf...),登录后获得, 以 Cookie 请求头携带。

请求参数 ​

参数位置类型必填说明
x-csrf-tokenheaderstring✓CSRF token(取自会话 Cookie 中的 CSRFTOKEN,或页面返回的 token),Web 写操作必带

请求体(application/x-www-form-urlencoded,必填) ​

字段类型必填说明
i_idinteger✓小说 ID
del_idinteger✓要删除的评论 ID

响应 ​

状态码说明结构
200删除结果(error=false 表示成功)WebApiEnvelope
401未登录WebApiEnvelope

200 响应字段(application/json)

字段类型必填说明
errorboolean✓是否出错
messagestring出错时的错误信息
bodyany业务数据(结构随端点而异)

本项目仅供学习与研究使用,与 Pixiv Inc. 无关。