添加 获取直播间信息 API (#452)

This commit is contained in:
TES286 2022-08-24 23:34:45 +08:00 committed by GitHub
parent 7da06779c5
commit 340646baf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
# 直播间基本信息
- [直播间基本信息](#直播间基本信息)
- [获取直播间信息](#获取直播间信息)
- [获取用户对应的直播间状态](#获取用户对应的直播间状态)
- [获取房间页初始化信息](#获取房间页初始化信息)
- [获取主播信息](#获取主播信息)
@ -8,6 +9,207 @@
---
## 获取直播间信息
> http://api.live.bilibili.com/room/v1/Room/get_info
*请求方式: GET*
**URL参数**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------ | ---- | ----------- | ----- | --------- |
| room_id| num | 直播间号 | 必要 | 可以为短号 |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | --------------------------- |
| code | num | 返回值 | 0成功<br />1不存在 |
| message | str | 错误信息 | |
| msg | str | 错误信息 | |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ------------------ | ---- | -------- | --------------------------- |
| uid | num | 主播mid | |
| room_id | num | 直播间长号| |
| short_id | num | 直播间短号| 为0是无短号 |
| attention | num | 关注数量 | |
| online | num | 观看人数 | |
| is_portrait | bool | 是否竖屏 | |
| description | str | 描述 | |
| liveStatus | num | 直播状态 | 0未开播<br />1直播中<br />2轮播中 |
| area_id | num | 分区id | |
| area_name | str | 分区名称 | |
| parent_area_id | num | 父分区id | |
| parent_area_name | str | 父分区名称 | |
| old_area_id | num | 旧版分区id | |
| background | str | 背景图片链接| |
| title | str | 标题 | |
| user_cover | str | 封面 | |
| keyframe | str | 关键帧 | 用于网页端悬浮展示 |
| is_strict_room | bool | 未知 | 未知 |
| live_time | str | 直播开始时间 | YYYY-MM-DD HH:mm:ss |
| tags | str | 标签 | ','分隔 |
| is_anchor | num | 未知 | 未知 |
| room_silent_type | str | 禁言状态 | |
| room_silent_level | num | 禁言等级 | |
| room_silent_second | num | 禁言时间 | 单位是秒 |
| pardants | str | 未知 | 未知 |
| area_pardants | str | 未知 | 未知 |
| hot_words | list(str) | 热词 | |
| hot_words_status | num | 热词状态 | |
| verify | str | 未知 | 未知 |
| new_pendants | obj | 头像框\大v | |
| up_session | str | 未知 | |
| pk_status | num | pk状态 | |
| pk_id | num | pk id | |
| battle_id | num | 未知 | |
`new_pendants`对象:
| 字段 | 类型 | 内容 | 备注 |
| ------------ | ---- | -------- | --------------------------- |
| frame | obj | 头像框 | |
| mobile_frame | obj | 同上 | 手机版, 结构一致, 可能null |
| badge | obj | 大v | |
| mobile_badge | obj | 同上 | 手机版, 结构一致, 可能null |
`frame`对象:
| 字段 | 类型 | 内容 | 备注 |
| ------------ | ---- | -------- | --------------------------- |
| name | str | 名称 ||
| value | str | 值 ||
| position | num | 位置 ||
| desc | str | 描述 ||
| area | num | 分区 ||
| area_old | num | 旧分区 ||
| bg_color | str | 背景色 ||
| bg_pic | str | 背景图 ||
| use_old_area | bool | 是否旧分区号 ||
`badge`对象:
| 字段 | 类型 | 内容 | 备注 |
| ------------ | ---- | -------- | --------------------------- |
| name | str | 类型 | v_person: 个人认证(黄) <br> v_company: 企业认证(蓝) |
| position | num | 位置 ||
| value | str | 值 ||
| desc | str | 描述 ||
**示例:**
查询直播间`room_id=1`信息
```shell
curl -G 'http://api.live.bilibili.com/room/v1/Room/get_info' \
--data-urlencode 'room_id=1'
```
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"msg": "ok",
"message": "ok",
"data": {
"uid": 9617619,
"room_id": 5440,
"short_id": 1,
"attention": 11919499,
"online": 0,
"is_portrait": false,
"description": "欢迎加入bilibili《快乐运动研究社》和B站UP主们一起探讨有关运动的经历感受解决身体和情绪的“疑难杂症”寻找适合自己的运动一起跟练本期我们一起探讨运动健身能缓解社交恐惧吗",
"live_status": 2,
"area_id": 145,
"parent_area_id": 1,
"parent_area_name": "娱乐",
"old_area_id": 6,
"background": "",
"title": "快乐运动研究社",
"user_cover": "https://i0.hdslb.com/bfs/live/new_room_cover/96943b8d106a777a34cf796421bb4254163b30e1.jpg",
"keyframe": "https://i0.hdslb.com/bfs/live-key-frame/keyframe08121926000000005440np0q7a.jpg",
"is_strict_room": false,
"live_time": "0000-00-00 00:00:00",
"tags": "",
"is_anchor": 0,
"room_silent_type": "",
"room_silent_level": 1,
"room_silent_second": 0,
"area_name": "视频聊天",
"pendants": "",
"area_pendants": "",
"hot_words": [
"2333333",
"喂,妖妖零吗",
"红红火火恍恍惚惚",
"FFFFFFFFFF",
"Yooooooo",
"啪啪啪啪啪",
"666666666",
"老司机带带我",
"你为什么这么熟练啊",
"gg",
"prprpr",
"向大佬低头",
"请大家注意弹幕礼仪哦!",
"还有这种操作!",
"囍",
"打call",
"你气不气?",
"队友呢?"
],
"hot_words_status": 0,
"verify": "",
"new_pendants": {
"frame": {
"name": "",
"value": "",
"position": 0,
"desc": "",
"area": 0,
"area_old": 0,
"bg_color": "",
"bg_pic": "",
"use_old_area": false
},
"badge": {
"name": "v_company",
"position": 3,
"value": "",
"desc": "哔哩哔哩直播官方账号"
},
"mobile_frame": {
"name": "",
"value": "",
"position": 0,
"desc": "",
"area": 0,
"area_old": 0,
"bg_color": "",
"bg_pic": "",
"use_old_area": false
},
"mobile_badge": null
},
"up_session": "",
"pk_status": 0,
"pk_id": 0,
"battle_id": 0,
"allow_change_area_time": 0,
"allow_upload_cover_time": 0,
"studio_info": {
"status": 0,
"master_list": []
}
}
}
```
</details>
## 获取用户对应的直播间状态
> https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld
@ -431,4 +633,4 @@ curl 'http://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids' \
}
```
</details>
</details>