bilibili-API-collect/docs/live/user.md

354 lines
11 KiB
Markdown
Raw Normal View History

2023-02-22 01:00:06 +08:00
# 直播间用户实用 API
## 获取用户持有的粉丝勋章信息
2023-02-23 11:48:58 +08:00
> ~~https://api.live.bilibili.com/fans_medal/v5/live_fans_medal/iApiMedal~~ (旧)
2023-02-22 01:00:06 +08:00
> https://api.live.bilibili.com/xlive/app-ucenter/v1/user/GetMyMedals
2023-02-23 11:48:58 +08:00
*请求方式GET*
2023-02-22 01:00:06 +08:00
认证方式CookieSESSDATA或 APP
**url 参数:**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| --------- | ---- | ------------ | ------ | ------------------------------------------------- |
| page_size | num | 每页的数量 | 必要 | 最大为 10超出 `1002002参数异常` |
| page | num | 返回结果页数 | 必要 | 两个参数不填返回空,只 page 不填或错误则 500 异常 |
**json 回复:**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ------------------------------------------------- |
调整部分接口描述与错误修复 (#1088) * fix(search/search_request.md): cookie buvid3 * feat(login/login_action/password.md): more sms desc * fix: typo * feat(live/info.md): add ps for getRoomBaseInfo * fix(danmaku/action.md): broken form * chore: Browserslist: caniuse-lite is outdated * feat(comment/list.md): reply/wbi/main param next * feat(misc/buvid3_4.md): get buvid3 only * fix: broken links & wrong code type * feat: close all img & br tags * feat(login/cookie_refresh.md): missing demo links * feat(dynamic/detail.md): /lottery_svr/v1/lottery_svr/lottery_notice * fix(video/action.md): share cookie buvid3 * feat: deprecated stat & attribute * feat(dynamic/detail.md): reaction * feat(misc/sign/v_voucher.md): header * feat(dynamic/detail.md): update detail params & example * feat(APP_widget/ver.md): /x/v2/version * feat(video/info.md): update view * feat(docs/user.md): remove channel * feat(search/search_request.md): search/type -1200 * feat(user/space.md): audio * feat(video/player.md): /x/player/wbi/v2 * feat(audio/musicstream_url.md): update web/url * feat(comment/readme.md): state * fix(user/medal.md): wrong guard_level desc * feat(live/message_stream.md): DANMU_MSG * fix(user/medals): wrong guard_level & guard_icon desc * feat(live/message_stream.md): format & add more 'cmd' * feat(live/message_stream.md): add more 'cmd' * feat(live/message_stream.md): add tips for non-login users * feat(video/player.md): need_login_subtitle --------- Co-authored-by: 社会易姐QwQ <45892418+SocialSisterYi@users.noreply.github.com>
2024-09-19 23:17:33 +08:00
| code | num | 返回值 | 0成功<br />-1002002参数异常<br />-500服务器异常 |
2023-02-22 01:00:06 +08:00
| message | str | 错误信息 | 默认为 "0" |
| ttl | num | 1 | |
2023-02-22 01:00:06 +08:00
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| --------- | ----- | ---------------- | ---- |
| count | num | 勋章数量 | |
| items | array | 粉丝勋章信息本体 | |
| page_info | obj | 页码信息 | |
2023-02-23 11:48:58 +08:00
`items`数组中的对象:
2023-02-22 01:00:06 +08:00
| 字段 | 类型 | 内容 | 备注 |
| ------------------ | ------ | -------------------- | -------------------------------------- |
| can_delete | bool | 可否删除 | |
| day_limit | num | 日经验上限(原力值) | eg: 1500 |
| guard_level | num | | |
| guard_medal_title | str | 加成状态 | |
| intimacy | num | 当前已得亲密度 | |
调整部分接口描述与错误修复 (#1088) * fix(search/search_request.md): cookie buvid3 * feat(login/login_action/password.md): more sms desc * fix: typo * feat(live/info.md): add ps for getRoomBaseInfo * fix(danmaku/action.md): broken form * chore: Browserslist: caniuse-lite is outdated * feat(comment/list.md): reply/wbi/main param next * feat(misc/buvid3_4.md): get buvid3 only * fix: broken links & wrong code type * feat: close all img & br tags * feat(login/cookie_refresh.md): missing demo links * feat(dynamic/detail.md): /lottery_svr/v1/lottery_svr/lottery_notice * fix(video/action.md): share cookie buvid3 * feat: deprecated stat & attribute * feat(dynamic/detail.md): reaction * feat(misc/sign/v_voucher.md): header * feat(dynamic/detail.md): update detail params & example * feat(APP_widget/ver.md): /x/v2/version * feat(video/info.md): update view * feat(docs/user.md): remove channel * feat(search/search_request.md): search/type -1200 * feat(user/space.md): audio * feat(video/player.md): /x/player/wbi/v2 * feat(audio/musicstream_url.md): update web/url * feat(comment/readme.md): state * fix(user/medal.md): wrong guard_level desc * feat(live/message_stream.md): DANMU_MSG * fix(user/medals): wrong guard_level & guard_icon desc * feat(live/message_stream.md): format & add more 'cmd' * feat(live/message_stream.md): add more 'cmd' * feat(live/message_stream.md): add tips for non-login users * feat(video/player.md): need_login_subtitle --------- Co-authored-by: 社会易姐QwQ <45892418+SocialSisterYi@users.noreply.github.com>
2024-09-19 23:17:33 +08:00
| is_lighted | num | 是否点亮 | 0未点亮<br />1点亮 |
2023-02-22 01:00:06 +08:00
| level | num | 勋章等级 | |
| medal_name | str | 勋章名 | |
| medal_color_border | num | 勋章边框颜色信息 | 颜色数值为 10 进制的 16 进制值(下同) |
| medal_color_start | num | 勋章起始颜色 | 从右往左渐变20 级+勋章) |
| medal_color_end | num | 勋章结束颜色 | 从右往左渐变20 级+勋章) |
| medal_id | num | 粉丝勋章 id | |
| next_intimacy | num | 升级所需经验 | |
| today_feed | num | 本日亲密度 | |
| roomid | num | 直播间房间号 | |
| status | num | | |
| target_id | number | up 主 mid | |
| target_name | str | up 主用户名 | |
| uname | str | up 主用户名 | |
`page_info`对象:
| 字段 | 类型 | 内容 | 备注 |
| ---------- | ---- | -------------- | ---- |
| total_page | num | 页码总长度 | |
| cur_page | num | 当前返回的页码 | |
**示例:**
```shell
curl https://api.live.bilibili.com/xlive/app-ucenter/v1/user/GetMyMedals?page=1&page_size=10 \
-b "SESSDATA=xxx"
```
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"items": [
{
"can_deleted": true,
"day_limit": 1500,
"guard_level": 0,
"guard_medal_title": "未开启加成",
"intimacy": 9617,
"is_lighted": 0,
"level": 11,
"medal_name": "锦依卫",
"medal_color_border": 12632256,
"medal_color_end": 12632256,
"medal_color_start": 12632256,
"medal_id": 29245,
"next_intimacy": 10000,
"today_feed": 0,
"roomid": 1546736,
"status": 0,
"target_id": 36081646,
"target_name": "洛天依",
"uname": "洛天依"
}
],
"page_info": {
"cur_page": 1,
"total_page": 1
},
"count": 1
}
}
```
</details>
## 佩戴勋章
> https://api.live.bilibili.com/xlive/web-room/v1/fansMedal/wear
2023-02-23 11:48:58 +08:00
*请求方式POST*
2023-02-22 01:00:06 +08:00
**表单参数:**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ---------- | ---- | ----------------------- | ------ | ---- |
| medal_id | num | 勋章 id | 必要 | |
| csrf | num | cookie 中 bili_jct 字段 | 必要 | |
| csrf_token | num | 同上 | 必要 | |
**json 回复:**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | -------------- |
| code | num | 返回值 | 0成功 |
| ttl | num | 1 | |
2023-02-22 01:00:06 +08:00
| message | str | 错误信息 | 默认为佩戴成功 |
| data | obj | 信息本体 | 默认为无 |
**示例:**
佩戴勋章 id 为 1 的勋章
```JavaScript
var madelForm = new FormData();
madelForm.append("medal_id", 1);
madelForm.append("csrf", bili_jct);
madelForm.append("csrf_token", bili_jct);
$.ajax({
url: "https://api.live.bilibili.com/xlive/web-room/v1/fansMedal/wear",
type: "POST",
data: madelForm,
dataType: "JSON",
processData: false,
contentType: false,
cache: false,
xhrFields: {
withCredentials: true
},
success: function (){
}
})
```
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"message": "佩戴成功",
"ttl": 1,
"data": {}
}
```
</details>
## 直播签到
> https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign
_请求方式GET_
认证方式CookieSESSDATA或 APP
**json 回复:**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ---------------------- |
调整部分接口描述与错误修复 (#1088) * fix(search/search_request.md): cookie buvid3 * feat(login/login_action/password.md): more sms desc * fix: typo * feat(live/info.md): add ps for getRoomBaseInfo * fix(danmaku/action.md): broken form * chore: Browserslist: caniuse-lite is outdated * feat(comment/list.md): reply/wbi/main param next * feat(misc/buvid3_4.md): get buvid3 only * fix: broken links & wrong code type * feat: close all img & br tags * feat(login/cookie_refresh.md): missing demo links * feat(dynamic/detail.md): /lottery_svr/v1/lottery_svr/lottery_notice * fix(video/action.md): share cookie buvid3 * feat: deprecated stat & attribute * feat(dynamic/detail.md): reaction * feat(misc/sign/v_voucher.md): header * feat(dynamic/detail.md): update detail params & example * feat(APP_widget/ver.md): /x/v2/version * feat(video/info.md): update view * feat(docs/user.md): remove channel * feat(search/search_request.md): search/type -1200 * feat(user/space.md): audio * feat(video/player.md): /x/player/wbi/v2 * feat(audio/musicstream_url.md): update web/url * feat(comment/readme.md): state * fix(user/medal.md): wrong guard_level desc * feat(live/message_stream.md): DANMU_MSG * fix(user/medals): wrong guard_level & guard_icon desc * feat(live/message_stream.md): format & add more 'cmd' * feat(live/message_stream.md): add more 'cmd' * feat(live/message_stream.md): add tips for non-login users * feat(video/player.md): need_login_subtitle --------- Co-authored-by: 社会易姐QwQ <45892418+SocialSisterYi@users.noreply.github.com>
2024-09-19 23:17:33 +08:00
| code | num | 返回值 | 0成功<br />1参数错误 |
| ttl | num | 1 | |
2023-02-22 01:00:06 +08:00
| message | str | 错误信息 | 默认为当日签到奖励内容 |
| data | obj | 信息本体 | 默认为空 |
## 本月直播签到信息
> https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/WebGetSignInfo
2023-02-23 11:48:58 +08:00
*请求方式GET*
2023-02-22 01:00:06 +08:00
认证方式CookieSESSDATA或 APP
**json 回复:**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ---------------------- |
| code | num | 返回值 | 0成功 |
| ttl | num | 1 | |
2023-02-22 01:00:06 +08:00
| message | str | 错误信息 | 默认为0 |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ----------------- | ----- | ---------------------------- | ---------------------- |
| text | str | 今日签到奖励信息 | 默认为空 |
| specialText | str | 连续签到奖励信息 | 默认为空 |
调整部分接口描述与错误修复 (#1088) * fix(search/search_request.md): cookie buvid3 * feat(login/login_action/password.md): more sms desc * fix: typo * feat(live/info.md): add ps for getRoomBaseInfo * fix(danmaku/action.md): broken form * chore: Browserslist: caniuse-lite is outdated * feat(comment/list.md): reply/wbi/main param next * feat(misc/buvid3_4.md): get buvid3 only * fix: broken links & wrong code type * feat: close all img & br tags * feat(login/cookie_refresh.md): missing demo links * feat(dynamic/detail.md): /lottery_svr/v1/lottery_svr/lottery_notice * fix(video/action.md): share cookie buvid3 * feat: deprecated stat & attribute * feat(dynamic/detail.md): reaction * feat(misc/sign/v_voucher.md): header * feat(dynamic/detail.md): update detail params & example * feat(APP_widget/ver.md): /x/v2/version * feat(video/info.md): update view * feat(docs/user.md): remove channel * feat(search/search_request.md): search/type -1200 * feat(user/space.md): audio * feat(video/player.md): /x/player/wbi/v2 * feat(audio/musicstream_url.md): update web/url * feat(comment/readme.md): state * fix(user/medal.md): wrong guard_level desc * feat(live/message_stream.md): DANMU_MSG * fix(user/medals): wrong guard_level & guard_icon desc * feat(live/message_stream.md): format & add more 'cmd' * feat(live/message_stream.md): add more 'cmd' * feat(live/message_stream.md): add tips for non-login users * feat(video/player.md): need_login_subtitle --------- Co-authored-by: 社会易姐QwQ <45892418+SocialSisterYi@users.noreply.github.com>
2024-09-19 23:17:33 +08:00
| status | num | 签到状态 | 0未签到<br />1已签到 |
2023-02-22 01:00:06 +08:00
| allDays | num | 当月天数 | |
| curMonth | num | 当前月 | |
| curYear | num | 当前年 | |
| curDay | num | 当前日 | |
| curData | str | 当前日期(格式化) | eg: 2023-2-19 |
| hadSignDays | num | 当月已签到天数 | 默认为0 |
| newTask | num | 作用未知 | 默认为0 |
| signDaysList | array | 当月已签到日列表 | 默认为空 |
| signBonusDaysList | array | 当月已签到且有特殊奖励日列表 | 默认为空 |
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"text": "3000点用户经验,2根辣条",
"specialText": "再签到7天可以获得50根辣条",
"status": 1,
"allDays": 28,
"curMonth": 2,
"curYear": 2023,
"curDay": 19,
"curDate": "2023-2-19",
"hadSignDays": 13,
"newTask": 0,
"signDaysList": [
2,
3,
4,
5,
6,
7,
11,
13,
14,
15,
17,
18,
19
],
"signBonusDaysList": [
6
]
}
}
```
</details>
## 上月直播签到信息
> https://api.live.bilibili.com/sign/getLastMonthSignDays
2023-02-23 11:48:58 +08:00
*请求方式GET*
2023-02-22 01:00:06 +08:00
认证方式CookieSESSDATA或 APP
**json 回复:**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ---------------------- |
| code | num | 返回值 | 0成功 |
| ttl | num | 1 | |
2023-02-22 01:00:06 +08:00
| message | str | 错误信息 | 默认为0 |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ----------------- | ----- | ---------------------------- | -------- |
| days | num | 上月天数 | |
| month | num | 上月月份值 | |
| hadSignDays | num | 上月已签到天数 | 默认为0 |
| signDaysList | array | 上月已签到日列表 | 默认为空 |
| signBonusDaysList | array | 上月已签到且有特殊奖励日列表 | 默认为空 |
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"month": 1,
"days": 31,
"hadSignDays": 20,
"signDaysList": [
1,
2,
3,
6,
7,
8,
10,
12,
13,
14,
15,
18,
20,
23,
24,
25,
26,
27,
30,
31
],
"signBonusDaysList": [
7,
31
]
}
}
```
</details>