Skip to content

Latest commit

 

History

History
212 lines (196 loc) · 9.93 KB

action.md

File metadata and controls

212 lines (196 loc) · 9.93 KB

评论区操作

发表评论

http://api.bilibili.com/x/v2/reply/add

方式:POST

需要登录(SESSDATA)

正文参数( application/x-www-form-urlencoded ):

参数名 类型 内容 必要性 备注
type num 评论区类型代码 必要 类型代码见「评论区明细
oid num 目标评论区ID 必要
root num 根评论ID 非必要 二级评论以上使用
parent num 夫评论ID 非必要 二级评论同根评论ID
大于二级评论为要回复的评论ID
message str 发送评论内容 必要 最大1000字符
表情使用表情转义符
plat num 发送平台标识 非必要 1:web端
2:安卓客户端
3:ios客户端
4:wp客户端
默认为1
csrf str cookies中的bili_jct 必要

json回复:

根对象:

字段 类型 内容 备注
code num 返回值 0:成功
-101:账号未登录
-102:账号被封停
-111:csrf校验失败
-400:请求错误
-404:无此项
12002:评论区已关闭
12009:评论主体的type不合法
12025:评论字数过多
(其他错误码有待补充)
message str 错误信息 默认为0
ttl num 1 作用尚不明确
data 正确时:obj
错误时: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
若为二级评论则为该评论ID
大于二级评论为上一级评论ID
dialog_str str 回复对方ID
root num 根评论ID 若为一级评论则为0
大于一级评论则为根评论ID
root_str str 根评论ID
parent num 回复父评论ID 若为一级评论则为0
若为二级评论则为根评论ID
大于二级评论为上一级评论ID
parent_str str 回复父评论ID
emote obj 表情转义符信息 无表情时无此项
见「评论区明细」的附表
reply 有效时:obj
无效时:null
见「评论区明细」的附表

示例:

给视频av243322853发送内容为测试test[泠鸢yousa_awsl]的评论(带有表情转义符),平台标识为1(web端)

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"

{
    "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
        }
    }
}