Skip to content

Commit

Permalink
添加 开通直播间 (SocialSisterYi#1050)
Browse files Browse the repository at this point in the history
开通直播间API
  • Loading branch information
kroyoo authored Jul 10, 2024
1 parent 2382b76 commit 70eb852
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions docs/live/manage.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,83 @@
# 直播间管理

## 开通直播间

> https://api.live.bilibili.com/xlive/app-blink/v1/preLive/CreateRoom
*请求方式:POST*

认证方式:Cookie(SESSDATA)

鉴权方式:Cookie中`bili_jct`的值正确并与`csrf`相同

**正文参数( application/x-www-form-urlencoded ):**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------- | ---- | ------------------------ | ------ | -------------------- |
| platform | str | 客户端? | 必要 | 默认值web |
| visit_id | str | 未知 | | 默认空 |
| csrf | str | CSRF Token(位于cookie) | 必要 | |
| csrf_token | str | CSRF Token(位于 cookie) | | |


**json回复:**

根对象:

| 字段 | 类型 | 内容 | 备注 |
| ------- | ------ | -------- | ------------------------------------------------------ |
| code | num | 返回值 | 0:成功<br />1531193016:已经创建直播间~<br />-400:请求错误 |
| ttl | str | 错误信息 | 默认为1 |
| message | str | 错误信息 | 默认为0 |
| data | array | 信息本体 | |

`data`对象:

| 字段 | 类型 | 内容 | 备注 |
| --------- | ----- | ---------------- | ---------------------- |
| roomID | str | 直播间房间号 | 创建成功返回直播间号 |

**示例:**

开通直播间

```shell
curl 'https://api.live.bilibili.com/xlive/app-blink/v1/preLive/CreateRoom' \
--data-urlencode 'platform=web' \
--data-urlencode 'visit_id=' \
--data-urlencode 'csrf=xxx' \
--data-urlencode 'csrf_token=xxx' \
-b 'SESSDATA=xxx;bili_jct=xx'
```

<details>
<summary>查看响应示例:</summary>

```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"roomID": "1234"
}
}
```

```json
{
"code": 1531193016,
"message": "已经创建直播间~",
"ttl": 1,
"data": {
"roomID": ""
}
}
```

</details>



## 更新直播间标题

> https://api.live.bilibili.com/room/v1/Room/update
Expand Down

0 comments on commit 70eb852

Please sign in to comment.