diff --git a/README.md b/README.md
index 0a71e21..b6f167d 100644
--- a/README.md
+++ b/README.md
@@ -68,13 +68,15 @@
- 状态数
- 操作
- [视频弹幕](danmaku)
- - [protobuf实时弹幕](danmaku/danmaku_proto.md)
+ - [protobuf实时弹幕](danmaku/danmaku_proto.md)×
+ - protobuf云推荐弹幕
- [xml实时弹幕](danmaku/danmaku_xml.md)√
- [xml历史弹幕](danmaku/history.md)√
- [快照](danmaku/snapshot.md)√
- [弹幕操作](danmaku/action.md)×
- 高级弹幕
- 屏蔽管理
+ - 智能防挡弹幕
- [专栏](article)
- 分区
- [基本信息](article/info.md)×
diff --git a/danmaku/action.md b/danmaku/action.md
index 6eca341..6278936 100644
--- a/danmaku/action.md
+++ b/danmaku/action.md
@@ -18,10 +18,10 @@
| bvid | str | 视频bvID | 必要(可选) | avID与bvID任选一个 |
| aid | num | 视频avID | 必要(可选) | avID与bvID任选一个 |
| progress | num | 弹幕出现在视频内的时间 | 非必要 | 单位为毫秒
默认为0 |
-| color | num | 弹幕颜色设置 | 非必要 | 详见[「弹幕」中的属性 p](danmaku.md#属性 p)
默认为16777215(#FFFFFF)白色 |
-| fontsize | num | 弹幕字号设置 | 非必要 | 详见[「弹幕」中的属性 p](danmaku.md#属性 p)
默认为25 |
-| pool | num | 弹幕池选择 | 非必要 | 0:普通弹幕
1:字幕弹幕
2:BAS弹幕
默认为0 |
-| mode | num | 弹幕类型选择 | 必要 | 1:普通
4:底部
5:顶部
7:高级
9:BAS(`pool`必须为2) |
+| color | num | 弹幕颜色设置 | 非必要 | 十进制RGB888值
默认为16777215(#FFFFFF)白色 |
+| fontsize | num | 弹幕字号设置 | 非必要 | 默认为25 |
+| pool | num | 弹幕池选择 | 非必要 | 0:普通池
1:字幕池
2:特殊池(代码/BAS弹幕)
默认为0 |
+| mode | num | 弹幕类型选择 | 必要 | 1:普通弹幕
4:底部弹幕
5:顶部弹幕
7:高级弹幕
9:BAS弹幕(`pool`必须为2) |
| rnd | num | 16位10进制随机数 | 非必要 | **若无此项,则发送弹幕冷却时间限制为90s**
若有此项,则发送弹幕冷却时间限制为5s |
| csrf | str | CSRF Token(位于cookie) | 必要 | |
diff --git a/danmaku/danmaku_proto.md b/danmaku/danmaku_proto.md
index da1dfb2..248f4d6 100644
--- a/danmaku/danmaku_proto.md
+++ b/danmaku/danmaku_proto.md
@@ -1,46 +1,54 @@
# protobuf弹幕
-2020年5月23日,哔哩哔哩网页端启用了新的默认弹幕api,网页端弹幕显示的上限变为原弹幕池上限的两倍。
+2020年5月23日,哔哩哔哩网页端及移动端启用了新的默认弹幕api,网页端弹幕显示的上限变为原弹幕池上限的两倍。
-哔哩哔哩的视频是以6分钟为一个单位加载的,新的api也是以6分钟为一个单位加载,即每次加载6分钟内的弹幕,如果打开右侧的弹幕列表就会一次加载完所有的弹幕。
+新的api是以6分钟为一个单位加载,即每次加载6分钟内的弹幕
## 获取实时弹幕
-> https://api.bilibili.com/x/v2/dm/web/seg.so
+> http://api.bilibili.com/x/v2/dm/web/seg.so
+>
+> http://api.bilibili.com/x/v2/dm/list/seg.so
-*请求方式:GET*
+*请求方式:GET*
+
+此接口与漫画弹幕相同
+
+只能返回普通和高级弹幕,代码(BAS)弹幕请从云推荐弹幕中获取
+
+**注:仅获取6min的整数倍时间内的弹幕(如第一包中弹幕`progress`值域为0-360000)**
**url参数:**
-| 参数名 | 类型 | 内容 | 必要性 | 备注 |
-| ------------- | ---- | ------- | ------ | --------- |
-| oid | num | 视频CID | 必要 | |
-| pid | num | 视频AID | 非必要 | |
-| type | num | 未知 | 必要 | 一般为1 |
-| segment_index | num | 分段 | 必要 | 6分钟一段 |
+| 参数名 | 类型 | 内容 | 必要性 | 备注 |
+| ------------- | ---- | -------- | ------ | ----------- |
+| type | num | 弹幕分类 | 必要 | 1:视频弹幕 |
+| oid | num | 视频CID | 必要 | |
+| pid | num | 视频avID | 非必要 | |
+| segment_index | num | 分包 | 必要 | 6分钟一包 |
-**返回:**
+**回复:**
-返回二进制数据,需要自行解析。
+返回二进制数据,需要自行解析
-只能返回普通和高级弹幕,代码弹幕请从弹幕云屏蔽中获取。
+**示例:**
+
+获取视频`av810872(CID=1176840)`的实时弹幕分段`1`
+
+```shell
+curl -G 'http://api.bilibili.com/x/v2/dm/web/seg.so'\
+--data-urlencode 'type=1'\
+--data-urlencode 'oid=1176840'\
+--data-urlencode 'pid=810872'\
+--data-urlencode 'segment_index=1'\
+-o 'danmaku.bin'
+```
+
+响应正文为protubuf二进制数据
## 弹幕格式
-| 名称 | 含义 | 类型 | 备注 |
-| -------- | -------------------- | ------ | ------------------------------------------------------------ |
-| id | 弹幕dmID | int64 | 唯一 可用于操作参数 |
-| progress | 视频内弹幕出现时间 | int32 | 毫秒 |
-| mode | 弹幕类型 | int32 | 1 2 3普通弹幕
4底部
5顶部
6逆向
7高级弹幕
8代码弹幕
9BAS弹幕 |
-| fontsize | 弹幕字号 | int32 | 18 小
25 标准
36 大 |
-| color | 弹幕颜色 | uint32 | 十进制RGB888值 |
-| midHash | 编码后的用户UID | string | 用于屏蔽用户和查看用户发送的所有弹幕 也可反查用户ID |
-| content | 弹幕内容 | string | 字符串是编码格式为\\+三位数字,数字是八进制,为utf-8编码 |
-| ctime | 弹幕发送时间 | int64 | 时间戳 |
-| weight | 权重 | int32 | 云屏蔽等级 |
-| action | 动作 | string | 未知 |
-| pool | 弹幕池 | int32 | 0普通池
1字幕池
2特殊池(高级弹幕) |
-| idStr | 弹幕dmID的字符串类型 | string | 唯一 可用于操作参数 |
+protobuf结构体:
**bilidm.proto**
@@ -48,44 +56,60 @@
syntax = "proto3";
message DanmakuElem {
- int64 id = 1;
- int32 progress = 2;
- int32 mode = 3;
- int32 fontsize = 4;
- uint32 color = 5;
- string midHash = 6;
- string content = 7;
- int64 ctime = 8;
- int32 weight = 9;
- string action = 10;
- int32 pool = 11;
- string idStr = 12;
+ int64 id = 1; //弹幕dmID
+ int32 progress = 2; //出现时间
+ int32 mode = 3; //弹幕类型
+ int32 fontsize = 4; //文字大小
+ uint32 color = 5; //弹幕颜色
+ string midHash = 6; //发送者UID的HASH
+ string content = 7; //弹幕内容
+ int64 ctime = 8; //发送时间
+ int32 weight = 9; //权重
+ string action = 10; //动作
+ int32 pool = 11; //弹幕池
+ string idStr = 12; //弹幕dmID
}
-//弹幕接口返回的数据
message DmSegMobileReply {
repeated DanmakuElem elems = 1;
}
```
-**实例:**
+| 名称 | 含义 | 类型 | 备注 |
+| -------- | -------------------- | ------ | ------------------------------------------------------------ |
+| id | 弹幕dmID | int64 | 唯一 可用于操作参数 |
+| progress | 视频内弹幕出现时间 | int32 | 毫秒 |
+| mode | 弹幕类型 | int32 | 1 2 3:普通弹幕
4:底部弹幕
5:顶部弹幕
6:逆向弹幕
7:高级弹幕
8:代码弹幕
9:BAS弹幕 |
+| fontsize | 弹幕字号 | int32 | 18:小
25:标准
36:大 |
+| color | 弹幕颜色 | uint32 | 十进制RGB888值 |
+| midHash | 发送者UID的HASH | string | 用于屏蔽用户和查看用户发送的所有弹幕 也可反查用户ID |
+| content | 弹幕内容 | string | utf-8编码 |
+| ctime | 弹幕发送时间 | int64 | 时间戳 |
+| weight | 权重 | int32 | 用于智能屏蔽级别 |
+| action | 动作 | string | 未知 |
+| pool | 弹幕池 | int32 | 0:普通池
1:字幕池
2:特殊池(代码/BAS弹幕) |
+| idStr | 弹幕dmID的字符串类型 | string | 唯一 可用于操作参数 |
-获取炮姐弹幕,https://www.bilibili.com/video/BV1Js411o76u
+## 实例
-编译proto文件
+获取炮姐弹幕第1包,[BV1Js411o76u](https://www.bilibili.com/video/BV1Js411o76u)
-```powershell
-protoc.exe --python_out=. .\bilidm.proto
+编译proto结构文件
+
+```shell
+protoc --python_out=. bilidm.proto
```
-生成文件:bilidm_pb2.py
+生成bilidm_pb2.py
-main.py
+---
+
+以下为python测试代码
```python
import bilidm_pb2
import requests
-url = 'https://api.bilibili.com/x/v2/dm/web/seg.so?type=1&oid=1176840&pid=810872&segment_index=1'
+url = 'http://api.bilibili.com/x/v2/dm/web/seg.so?type=1&oid=1176840&pid=810872&segment_index=1'
data = requests.get(url)
target = bilidm_pb2.DmSegMobileReply()
target.ParseFromString(data.content)
@@ -95,7 +119,7 @@ print(target.elems[0].content)
输出:
-```shell
+```
id: 682225690
progress: 44125
mode: 1
diff --git a/danmaku/danmaku_xml.md b/danmaku/danmaku_xml.md
index d6a04b3..f24f102 100644
--- a/danmaku/danmaku_xml.md
+++ b/danmaku/danmaku_xml.md
@@ -6,7 +6,7 @@
> http://api.bilibili.com/x/v1/dm/list.so
-*请求方式:GET*
+*请求方式:GET*
**使用deflate压缩,注意解码**
@@ -28,7 +28,7 @@ curl -G 'http://api.bilibili.com/x/v1/dm/list.so'\
> http://comment.bilibili.com/{cid}.xml
-*请求方式:GET*
+*请求方式:GET*
效果与前者相同
@@ -96,18 +96,18 @@ curl 'http://comment.bilibili.com/144541892.xml'
### 属性 p
-字符串内每项用`,`分隔
+字符串内每项用逗号`,`分隔
-| 项 | 含义 | 类型 | 备注 |
-| ---- | ------------------ | ----- | ------------------------------------------------------------ |
-| 0 | 视频内弹幕出现时间 | float | 秒 |
-| 1 | 弹幕类型 | int | 1 2 3普通弹幕
4底部
5顶部
6逆向
7精准定位
8代码弹幕
9BAS弹幕 |
-| 2 | 弹幕字号 | int | 18 小
25 标准
36 大 |
-| 3 | 弹幕颜色 | int | 十进制RGB888值 |
-| 4 | 弹幕发送时间 | int | 时间戳 |
-| 5 | 弹幕池类型 | int | 0普通池
1字幕池
2特殊池(高级弹幕) |
-| 6 | 编码后的用户UID | HEX | 用于屏蔽用户和查看用户发送的所有弹幕 也可反查用户ID |
-| 7 | 弹幕dmID | int | 唯一 可用于操作参数 |
+| 项 | 含义 | 类型 | 备注 |
+| ---- | ------------------ | ------ | ------------------------------------------------------------ |
+| 0 | 视频内弹幕出现时间 | float | 秒 |
+| 1 | 弹幕类型 | int32 | 1 2 3:普通弹幕
4:底部弹幕
5:顶部弹幕
6:逆向弹幕
7:高级弹幕
8:代码弹幕
9:BAS弹幕(`pool`必须为2) |
+| 2 | 弹幕字号 | int32 | 18:小
25:标准
36:大 |
+| 3 | 弹幕颜色 | int32 | 十进制RGB888值 |
+| 4 | 弹幕发送时间 | int32 | 时间戳 |
+| 5 | 弹幕池类型 | int32 | 0:普通池
1:字幕池
2:特殊池(代码/BAS弹幕) |
+| 6 | 发送者UID的HASH | string | 用于屏蔽用户和查看用户发送的所有弹幕 也可反查用户ID |
+| 7 | 弹幕dmID | int64 | 唯一 可用于操作参数 |
```xml
从结尾回来看这里,更感动了!