From c0f641ba653f3d145808c84c8d85ce9c75c7954c Mon Sep 17 00:00:00 2001 From: ProgramRipper <2892771624@qq.com> Date: Sat, 3 Oct 2020 09:12:05 +0800 Subject: [PATCH] Update action.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 保护&删除弹幕 --- danmaku/action.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/danmaku/action.md b/danmaku/action.md index cb4ab58..33eb2d6 100644 --- a/danmaku/action.md +++ b/danmaku/action.md @@ -672,3 +672,58 @@ curl 'http://api.bilibili.com/x/dm/report/add'\ ``` + +## 保护&删除弹幕 + +> http://api.bilibili.com/x/v2/dm/edit/state + +*请求方式:POST* + +认证方式:Cookie(SESSDATA) + +**正文参数( application/x-www-form-urlencoded ):** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | ------------------------ | -------------- | --------------------------------------------- | +| type | num | 1 | 必要 | | +| oid | num | 视频CID | 必要 | | +| dmids | nums | 弹幕dmID列表 | 必要 | 多个ID之间用`,`分隔 | +| state | num | 操作 | 必要 | 1:删除弹幕
2:弹幕保护
3:取消保护 | +| csrf | str | CSRF Token(位于cookie) | Cookie方式必要 | | + +**json回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ------------------------------------------------------------ | +| code | num | 返回值 | 0:成功
-101:账号未登录
-111:csrf 校验失败
-400:请求错误
-403:访问权限不足 | +| message | str | 错误信息 | 默认为0 | +| ttl | num | 1 | | + +**示例** + +删除`CID=145928946`下的弹幕`35600074482384899`、`39067304918515717`、`39082777041174531` + +```shell +curl 'http://api.bilibili.com/x/v2/dm/edit/state'\ +--data-urlencode 'type=1'\ +--data-urlencode 'oid=145928946'\ +--data-urlencode 'dmids=35600074482384899,39067304918515717,39082777041174531'\ +--data-urlencode 'state=1'\ +--data-urlencode 'csrf=xxx'\ +-b 'SESSDATA=xxx' +``` + +
+查看响应示例: + +```json +{ + "code":0, + "message":"0", + "ttl":1 +} +``` + +