bilibili-API-collect/broadcast/video_room.md

153 lines
5.5 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.

# 视频实时信息
- [认证包(上行)](#认证包上行)
- [认证包回复(下行)](#认证包回复下行)
- [心跳包(上行)](#心跳包上行)
- [心跳包回复(实时观看数)(下行)](#心跳包回复实时观看数下行)
- [普通包(实时弹幕)(下行)](#普通包实时弹幕下行)
---
## 认证包(上行)
**正文内容json**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| -------- | ------ | -------- | ------------------------------ |
| room_id | str | 目标视频 | `video://{稿件avid}/{视频cid}` |
| platform | str | 平台标识 | 默认为`web` |
| accepts | array | 操作标识 | |
`array`数组:
| 项 | 类型 | 内容 | 备注 |
| ---- | ---- | ---- | ------------ |
| 0 | num | 1000 | 作用尚不明确 |
| 1 | num | 1015 | 作用尚不明确 |
**示例:**
发送视频`av706`1P的cid为` 3724723 `)的认证包
```
00000000 00 00 00 55 00 12 00 01 00 00 00 07 00 00 00 01 |...U............|
00000010 00 00 7b 22 72 6f 6f 6d 5f 69 64 22 3a 22 76 69 |..{"room_id":"vi|
00000020 64 65 6f 3a 2f 2f 37 30 36 2f 33 37 32 34 37 32 |deo://706/372472|
00000030 33 22 2c 22 70 6c 61 74 66 72 6f 6d 22 3a 22 77 |3","platfrom":"w|
00000040 65 62 22 2c 22 61 63 63 65 70 74 73 22 3a 5b 31 |eb","accepts":[1|
00000050 30 30 30 2c 31 30 31 35 5d 7d |000,1015]}|
```
## 认证包回复(下行)
**正文内容json**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | -------- |
| code | num | 返回值 | 0成功 |
| message | str | 错误信息 | 默认为OK |
| version | num | 版本号 | |
示例:
```
00000000 00 00 00 37 00 12 00 01 00 00 00 08 00 00 00 01 |...7............|
00000010 00 00 7b 22 63 6f 64 65 22 3a 30 2c 22 6d 65 73 |..{"code":0,"mes|
00000020 73 61 67 65 22 3a 22 4f 4b 22 2c 22 76 65 72 73 |sage":"OK","vers|
00000030 69 6f 6e 22 3a 31 7d |ion":1}|
```
## 心跳包(上行)
正文可为任意内容或为空
**示例:**
正文为空的示例
```
00000000 00 00 00 12 00 12 00 01 00 00 00 02 00 00 00 01 |................|
00000010 00 00 |..|
```
正文为`[object Object]`的示例
```
00000000 00 00 00 21 00 12 00 01 00 00 00 02 00 00 00 01 |...!............|
00000010 00 00 5b 6f 62 6a 65 63 74 20 4f 62 6a 65 63 74 |..[object Object|
00000020 5d |]|
```
## 心跳包回复(实时观看数)(下行)
**正文内容json**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | -------- |
| code | num | 返回值 | 0成功 |
| message | str | 错误信息 | 默认为OK |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ---- | ---- | ---------------- | ---- |
| room | obj | 视频实时观看信息 | |
`data`中的`room`对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | ------------ | ------------------------------ |
| online | num | 实时观看人数 | |
| room_id | str | 目标视频 | `video://{稿件avid}/{视频cid}` |
**示例:**
当前视频`av706`实时观看人数为13
```
00000000 00 00 00 68 00 12 00 01 00 00 00 03 00 00 00 01 |...h............|
00000010 00 00 7b 22 63 6f 64 65 22 3a 30 2c 22 6d 65 73 |..{"code":0,"mes|
00000020 73 61 67 65 22 3a 22 30 22 2c 22 64 61 74 61 22 |sage":"0","data"|
00000030 3a 7b 22 72 6f 6f 6d 22 3a 7b 22 6f 6e 6c 69 6e |:{"room":{"onlin|
00000040 65 22 3a 31 33 2c 22 72 6f 6f 6d 5f 69 64 22 3a |e":13,"room_id":|
00000050 22 76 69 64 65 6f 3a 2f 2f 37 30 36 2f 33 37 32 |"video://706/372|
00000060 34 37 32 33 22 7d 7d 7d |4723"}}}|
```
## 普通包(实时弹幕)(下行)
**正文内容json**
根数组:
| 项 | 类型 | 内容 | 备注 |
| ---- | ---- | ------------ | ------------------------------------------------------------ |
| 0 | str | 弹幕属性信息 | 详见[「弹幕」中的属性 p](https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/danmaku/danmaku_xml.md) |
| 1 | str | 弹幕内容 | |
**示例:**
弹幕属性为`0.25,1,25,16777215,1588433046,1588431486568150,0,33ad5d91,32134068443807747`
弹幕内容为`此生无悔入东方,来世愿生幻想乡`
```
00000000 00 00 00 91 00 12 00 01 00 00 03 e8 00 00 00 00 |................|
00000010 00 00 5b 22 30 2e 32 35 2c 31 2c 32 35 2c 31 36 |..["0.25,1,25,16|
00000020 37 37 37 32 31 35 2c 31 35 38 38 34 33 33 30 34 |777215,158843304|
00000030 36 2c 31 35 38 38 34 33 31 34 38 36 35 36 38 31 |6,15884314865681|
00000040 35 30 2c 30 2c 33 33 61 64 35 64 39 31 2c 33 32 |50,0,33ad5d91,32|
00000050 31 33 34 30 36 38 34 34 33 38 30 37 37 34 37 22 |134068443807747"|
00000060 2c 22 e6 ad a4 e7 94 9f e6 97 a0 e6 82 94 e5 85 |,"此 生 无 悔|
00000070 a5 e4 b8 9c e6 96 b9 ef bc 8c e6 9d a5 e4 b8 96 |入 东 方 ,来 世 |
00000080 e6 84 bf e7 94 9f e5 b9 bb e6 83 b3 e4 b9 a1 22 |愿 生 幻 想 乡"|
00000090 5d |]|
```