update 【danmaku thumbup list】 APIDoc

This commit is contained in:
SocialSisterYi
2023-05-17 09:42:12 +08:00
parent 894c802ac5
commit 87d56b66e7
4 changed files with 155 additions and 125 deletions

View File

@@ -1,8 +1,8 @@
# protobuf弹幕
2020年5月23日哔哩哔哩网页端及移动端启用了新的默认弹幕api,网页端弹幕显示的上限变为原弹幕池上限的两倍。
2020年5月23日哔哩哔哩网页端及移动端启用了新的默认弹幕 API,网页端弹幕显示的上限变为原弹幕池上限的两倍。
新的api是以6分钟为一个单位加载,即每次加载6分钟内的弹幕
新的 API 是以 6min 为一个单位加载,即每次加载 6min 内的弹幕
## 获取实时弹幕
@@ -18,26 +18,29 @@
只能返回普通弹幕(`pool=1` `mode=1-7`)和代码弹幕(`pool=2` `mode=8`BAS弹幕`pool=2` `mode=9`)请从[弹幕元数据](danmaku_view_proto.md)中获取
互动弹幕UP主头像弹幕、关联视频、内嵌关注按钮也不存在这个接口请从[弹幕元数据](danmaku_view_proto.md)中获取
互动弹幕UP 主头像弹幕、关联视频、内嵌关注按钮)也不存在这个接口,请从[弹幕元数据](danmaku_view_proto.md)中获取
**注仅获取6min的整数倍时间内的弹幕6min内最多弹幕数为6000条如第一包中弹幕`progress`值域为0-360000**
**注:仅获取 6min 的整数倍时间内的弹幕6min 内最多弹幕数为 6000 条(如第一包中弹幕`progress`值域为0-360000**
**url参数**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------------- | ---- | -------- | ------ | ----------- |
| type | num | 弹幕类 | 必要 | 1视频弹幕 |
| oid | num | 视频cid | 必要 | |
| pid | num | 稿件avid | 非必要 | |
| segment_index | num | 分包 | 必要 | 6分钟一包 |
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------------- | ---- | --------- | ------ | ---------------------------- |
| type | num | 弹幕类 | 必要 | 1视频弹幕<br />2漫画弹幕 |
| oid | num | 视频 cid | 必要 | |
| pid | num | 稿件 avid | 非必要 | |
| segment_index | num | 分包 | 必要 | 6min 一包 |
| pull_mode | num | | 非必要 | |
| ps | num | | 非必要 | |
| pe | num | | 非必要 | |
**proto回复**
proto定义见[bilibili.community.service.dm.v1.DmSegMobileReply](../grpc_api/bilibili/community/service/dm/v1/dm.proto)
proto定义见[bilibili.community.service.dm.v1.DmSegMobileReply](../../grpc_api/bilibili/community/service/dm/v1/dm.proto)
- [protogen.marcgravell](https://protogen.marcgravell.com/): 在线编译protogen工具, 无需再安装本地编译器(生成文件需加后缀_pb2.py才可使用)
- [protogen.marcgravell](https://protogen.marcgravell.com/): 在线编译 protogen 工具, 无需再安装本地编译器(生成文件需加后缀`_pb2.py`才可使用)
- [protobuf pip](https://pypi.org/project/protobuf/): 可一键安装的pythonprotogen解析库
- [protobuf pip](https://pypi.org/project/protobuf/): 可一键安装的 Pythonprotogen 解析库
消息`DmSegMobileReply`
@@ -47,26 +50,28 @@ proto定义见[bilibili.community.service.dm.v1.DmSegMobileReply](../grpc_api
消息`DanmakuElem`
| 名称 | 类型 | 含义 | 备注 |
| -------- | ------ | ------------------ | ------------------------------------------------------------ |
| id | int64 | 弹幕dmid | 唯一 可用于操作参数 |
| progress | int32 | 视频内弹幕出现时间 | 毫秒 |
| mode | int32 | 弹幕类型 | 1 2 3普通弹幕<br />4底部弹幕<br />5顶部弹幕<br />6逆向弹幕<br />7高级弹幕<br />8代码弹幕<br />9BAS弹幕仅限于特殊弹幕专包 |
| fontsize | int32 | 弹幕字号 | 18<br />25标准<br />36大 |
| color | uint32 | 弹幕颜色 | 十进制RGB888值 |
| midHash | string | 发送者midHASH | 用于屏蔽用户和查看用户发送的所有弹幕 也可反查用户id |
| content | string | 弹幕内容 | utf-8编码 |
| ctime | int64 | 弹幕发送时间 | 时间戳 |
| weight | int32 | 权重 | 用于智能屏蔽根据弹幕语义及长度通过AI识别得出<br />范围:[0-10]<br />值越大权重越高 |
| action | string | 动作? | 作用尚不明确 |
| pool | int32 | 弹幕池 | 0普通池<br />1字幕池<br />2特殊池代码/BAS弹幕 |
| idStr | string | 弹幕dmid | 字串形式<br />唯一 可用于操作参数 |
| 名称 | 类型 | 含义 | 备注 |
| --------- | ------ | ------------------ | ------------------------------------------------------------ |
| id | int64 | 弹幕 dmid | 唯一 可用于操作参数 |
| progress | int32 | 视频内弹幕出现时间 | 毫秒 |
| mode | int32 | 弹幕类型 | 1 2 3普通弹幕<br />4底部弹幕<br />5顶部弹幕<br />6逆向弹幕<br />7高级弹幕<br />8代码弹幕<br />9BAS 弹幕(仅限于特殊弹幕专包) |
| fontsize | int32 | 弹幕字号 | 18<br />25标准<br />36大 |
| color | uint32 | 弹幕颜色 | 十进制 RGB888 值 |
| midHash | string | 发送者 midHASH | 用于屏蔽用户和查看用户发送的所有弹幕也可反查用户id |
| content | string | 弹幕内容 | utf-8编码 |
| ctime | int64 | 弹幕发送时间 | 时间戳 |
| weight | int32 | 权重 | 用于智能屏蔽根据弹幕语义及长度通过AI识别得出<br />范围:[0-10]<br />值越大权重越高 |
| action | string | 动作? | |
| pool | int32 | 弹幕池 | 0普通池<br />1字幕池<br />2特殊池代码/BAS弹幕 |
| idStr | string | 弹幕 dmid | 字串形式<br />唯一 可用于操作参数 |
| attr | int32 | 弹幕属性位 | bit0保护<br />bit1直播<br />bit2高赞 |
| animation | string | 动画? | |
**示例:**
获取视频`av810872(cid=1176840)`炮姐的实时弹幕分包1
获取视频`av810872(cid=1176840)`(炮姐)的实时弹幕分包 1
**注:[proto定义](../grpc_api/bilibili/community/service/dm/v1/dm.proto)需要编译,`bilibili.community.service.dm.v1.dm_pb2`并非通过pypi安装**
**注:以下[proto定义](../grpc_api/bilibili/community/service/dm/v1/dm.proto)需要编译,`bilibili.community.service.dm.v1.dm_pb2`并非通过 pypi 安装**
```python
import requests