bilibili-API-collect/comment/action.md
2020-06-16 13:04:32 +08:00

301 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 评论区操作
**本页所有操作均需登录SESSDATA**
## 发表评论
> http://api.bilibili.com/x/v2/reply/add
*方式POST*
**正文参数( application/x-www-form-urlencoded **
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------- | ---- | ------------------- | ------ | ------------------------------------------------------------ |
| type | num | 评论区类型代码 | 必要 | **类型代码见「[评论区明细](comment_list.md)」** |
| oid | num | 目标评论区ID | 必要 | |
| root | num | 根评论ID | 非必要 | 二级评论以上使用 |
| parent | num | 夫评论ID | 非必要 | 二级评论同根评论ID<br />大于二级评论为要回复的评论ID |
| message | str | 发送评论内容 | 必要 | 最大1000字符<br />表情使用表情转义符 |
| plat | num | 发送平台标识 | 非必要 | 1web端<br />2安卓客户端<br />3ios客户端<br />4wp客户端<br />默认为1 |
| csrf | str | cookies中的bili_jct | 必要 | |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ----------------------------- | -------- | ------------------------------------------------------------ |
| code | num | 返回值 | 0成功<br />-101账号未登录<br />-102账号被封停<br />-111csrf校验失败<br />-400请求错误<br />-404无此项<br />12002评论区已关闭<br />12006没有该评论<br />12009评论主体的type不合法<br />12025评论字数过多<br />**(其他错误码有待补充)** |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | **作用尚不明确** |
| data | 正确时obj<br />错误时null | 数据本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| -------------- | ----------------------------- | -------------- | ------------------------------------------------------------ |
| success_action | num | 0 | **作用尚不明确** |
| success_toast | str | 状态文字 | |
| need_captcha | bool | false | **作用尚不明确** |
| url | str | 空 | **作用尚不明确** |
| rpid | num | 评论ID | |
| rpid_str | str | 评论ID | |
| dialog | num | 回复对方ID | 若为一级评论则为0<br />若为二级评论则为该评论ID<br />大于二级评论为上一级评论ID |
| dialog_str | str | 回复对方ID | |
| root | num | 根评论ID | 若为一级评论则为0<br />大于一级评论则为根评论ID |
| root_str | str | 根评论ID | |
| parent | num | 回复父评论ID | 若为一级评论则为0<br />若为二级评论则为根评论ID<br />大于二级评论为上一级评论ID |
| parent_str | str | 回复父评论ID | |
| emote | obj | 表情转义符信息 | 无表情时无此项<br />**见「[评论区明细](comment_list.md#附表-评论条目对象)」的附表** |
| reply | 有效时obj<br />无效时null | | **见「[评论区明细](comment_list.md#附表-评论条目对象)」的附表** |
**示例:**
给视频`av243322853`发送内容为`测试test[泠鸢yousa_awsl]`的评论带有表情转义符平台标识为1web端
curl -b "SESSDATA=xxx" -d "type=1&oid=243322853&message=%E6%B5%8B%E8%AF%95test%5B%E6%B3%A0%E9%B8%A2yousa_awsl%5D&plat=1&csrf=xxx" "http://api.bilibili.com/x/v2/reply/add"
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"success_action": 0,
"success_toast": "发送成功",
"need_captcha": false,
"url": "",
"rpid": 3043212039,
"rpid_str": "3043212039",
"dialog": 0,
"dialog_str": "0",
"root": 0,
"root_str": "0",
"parent": 0,
"parent_str": "0",
"emote": {
"[泠鸢yousa_awsl]": {
"id": 2086,
"package_id": 93,
"state": 0,
"type": 3,
"attr": 0,
"text": "[泠鸢yousa_awsl]",
"url": "http://i0.hdslb.com/bfs/emote/7663b729161bd4556c2ec318c07791000743eb56.png",
"meta": {
"size": 2
},
"mtime": 1589776042
}
},
"reply": {
"rpid": 3043212039,
"oid": 243322853,
"type": 1,
"mid": 293793435,
"root": 0,
"parent": 0,
"dialog": 0,
"count": 0,
"rcount": 0,
"state": 0,
"fansgrade": 0,
"attr": 0,
"ctime": 1592233764,
"rpid_str": "3043212039",
"root_str": "0",
"parent_str": "0",
"like": 0,
"action": 0,
"member": {
"mid": "293793435",
"uname": "社会易姐QwQ",
"sex": "男",
"sign": "高中技术宅一枚爱好MC&电子&8-bit音乐&数码&编程,资深猿厨",
"avatar": "http://i1.hdslb.com/bfs/face/aebb2639a0d47f2ce1fec0631f412eaf53d4a0be.jpg",
"rank": "10000",
"DisplayRank": "0",
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 1888,
"name": "泠鸢yousa",
"image": "http://i0.hdslb.com/bfs/garb/item/3e66e712b8e70c6b02393c54ad5fd8d993eb39f9.png",
"expire": 0,
"image_enhance": "http://i0.hdslb.com/bfs/garb/item/3e66e712b8e70c6b02393c54ad5fd8d993eb39f9.png"
},
"nameplate": {
"nid": 0,
"name": "",
"image": "",
"image_small": "",
"level": "",
"condition": ""
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 2,
"vipDueDate": 1612454400000,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 1,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "年度大会员",
"label_theme": "annual_vip"
}
},
"fans_detail": null,
"following": 0,
"is_followed": 0,
"user_sailing": {
"pendant": {
"id": 1888,
"name": "泠鸢yousa",
"image": "http://i0.hdslb.com/bfs/garb/item/3e66e712b8e70c6b02393c54ad5fd8d993eb39f9.png",
"jump_url": "",
"type": "suit"
},
"cardbg": null,
"cardbg_with_focus": null
}
},
"content": {
"message": "测试test[泠鸢yousa_awsl]",
"plat": 1,
"device": "",
"members": [],
"emote": {
"[泠鸢yousa_awsl]": {
"id": 2086,
"package_id": 93,
"state": 0,
"type": 3,
"attr": 0,
"text": "[泠鸢yousa_awsl]",
"url": "http://i0.hdslb.com/bfs/emote/7663b729161bd4556c2ec318c07791000743eb56.png",
"meta": {
"size": 2
},
"mtime": 1589776042
}
},
"jump_url": {},
"max_line": 0
},
"replies": null,
"assist": 0,
"folder": {
"has_folded": false,
"is_folded": false,
"rule": "https://www.bilibili.com/blackboard/foldingreply.html"
},
"up_action": {
"like": false,
"reply": false
},
"show_follow": false
}
}
}
```
## 点赞评论
> http://api.bilibili.com/x/v2/reply/action
*方式POST*
点赞成功后会同时消去该评论的点踩
**正文参数( application/x-www-form-urlencoded **
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------ | ---- | ------------------- | ------ | ----------------------------------------------- |
| type | num | 评论区类型代码 | 必要 | **类型代码见「[评论区明细](comment_list.md)」** |
| oid | num | 目标评论区ID | 必要 | |
| rpid | num | 目标评论ID | 必要 | |
| action | num | 操作代码 | 非必要 | 默认为0<br />0取消赞<br />1点赞 |
| csrf | str | cookies中的bili_jct | 必要 | |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ------------------------------------------------------------ |
| code | num | 返回值 | 0成功<br />-101账号未登录<br />-102账号被封停<br />-111csrf校验失败<br />-400请求错误<br />-404无此项<br />12002评论区已关闭<br />12006没有该评论<br />12009评论主体的type不合法<br />12011不合法的赞或踩<br />**(其他错误码有待补充)** |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | **作用尚不明确** |
**示例:**
点赞视频`av243322853`下评论`3039053308`
curl -b "SESSDATA=xxx" -d "type=1&oid=243322853&rpid=3039053308&action=1&csrf=xxx" "http://api.bilibili.com/x/v2/reply/action"
```json
{
"code": 0,
"message": "0",
"ttl": 1
}
```
## 点踩评论
> http://api.bilibili.com/x/v2/reply/hate
*方式POST*
点踩成功后会同时消去该评论的点赞
**正文参数( application/x-www-form-urlencoded **
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------ | ---- | ------------------- | ------ | ----------------------------------------------- |
| type | num | 评论区类型代码 | 必要 | **类型代码见「[评论区明细](comment_list.md)」** |
| oid | num | 目标评论区ID | 必要 | |
| rpid | num | 目标评论ID | 必要 | |
| action | num | 操作代码 | 非必要 | 默认为0<br />0取消踩<br />1点踩 |
| csrf | str | cookies中的bili_jct | 必要 | |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ------------------------------------------------------------ |
| code | num | 返回值 | 0成功<br />-101账号未登录<br />-102账号被封停<br />-111csrf校验失败<br />-400请求错误<br />-404无此项<br />12002评论区已关闭<br />12006没有该评论<br />12009评论主体的type不合法<br />12011不合法的赞或踩<br />**(其他错误码有待补充)** |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | **作用尚不明确** |
**示例:**
点踩视频`av243322853`下评论`3039053308`
curl -b "SESSDATA=xxx" -d "type=1&oid=243322853&rpid=3039053308&action=1&csrf=xxx" "http://api.bilibili.com/x/v2/reply/hate"
```json
{
"code": 0,
"message": "0",
"ttl": 1
}
```