返回提交历史
Added
live/redpocket.md
+130
-0
XFEstudio/bilibili-API-collect
添加获取直播间红包接口 (#560)
* 获取直播间红包信息 * Rename redpocket to redpocket.md
ccf87cf
代码差异
1 个文件
+130
-0
@@ -0,0 +1,130 @@
1
# 直播间人气红包
2
3
- [获取指定直播间的红包信息](#获取指定直播间的红包信息)
4
5
---
6
7
## 获取指定直播间的红包信息
8
9
> https://api.live.bilibili.com/xlive/lottery-interface/v1/lottery/getLotteryInfoWeb
10
11
*请求方式:GET*
12
13
认证方式(可选):Cookie(SESSDATA)
14
15
如果不携带Cookie信息,user_status将始终返回2(未参与)。
16
17
如果所查询的直播间无红包,popularity_red_pocket为null。
18
19
**url参数:**
20
21
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
22
| ------- | ---- | ---------------- | ------ | ---- |
23
| roomid | str | 直播间id | 必要 | |
24
25
**json回复:**
26
27
根对象:
28
29
| 字段 | 类型 | 内容 | 备注 |
30
| ------- | ------ | ---------- | ------------- |
31
| code | num | 返回值 | 0:成功 |
32
| message | str | 错误信息 | 0:成功 |
33
| ttl | num | TimeToLive | 正常为1 |
34
| data | object | 返回数据 | |
35
36
`data`对象:
37
38
| 项 | 类型 | 内容 | 备注 |
39
| ---- | ---- | ----------- | ---- |
40
| popularity_red_pocket | array | 人气红包信息 | |
41
| …… | ...... | …… | …… |
42
43
`popularity_red_pocket`数组中的对象:
44
45
| 字段 | 类型 | 内容 | 备注 |
46
| ---- | ---- | ---------- | ---- |
47
| lot_id | num | 红包id | |
48
| sender_uid | num | 红包发送者uid | |
49
| sender_name | str | 红包发送者昵称 | |
50
| sender_face | str | 红包发送者头像 | |
51
| join_requirement | num | 参与条件? | |
52
| danmu | str | 参与红包时自动发送的弹幕内容 | |
53
| awards | array | 红包内容 | |
54
| lot_status | num | 未知 | |
55
| h5_url | str | 红包界面 | |
56
| user_status | num | 用户是否已参与 | 1:已参与 2:未参与 |
57
| lot_config_id | num | 未知 | |
58
| total_price | num | 红包总计价格 | |
59
60
**示例:**
61
62
查询房间号为24146996的直播间红包信息:
63
64
```shell
65
curl -G 'https://api.live.bilibili.com/xlive/lottery-interface/v1/lottery/getLotteryInfoWeb?roomid=24146996'
66
```
67
68
<details>
69
<summary>查看响应示例:</summary>
70
71
```json
72
73
{
74
"code": 0,
75
"message": "0",
76
"ttl": 1,
77
"data": {
78
"pk": null,
79
"guard": null,
80
"gift": null,
81
"storm": null,
82
"silver": null,
83
"activity_box": {
84
"ACTIVITY_ID": 0,
85
"ACTIVITY_PIC": ""
86
},
87
"danmu": null,
88
"anchor": null,
89
"red_pocket": null,
90
"popularity_red_pocket": [{
91
"lot_id": 622474,
92
"sender_uid": 1651908873,
93
"sender_name": "九泽糖糖の小蘑菇",
94
"sender_face": "http://i0.hdslb.com/bfs/face/c932c5c8b1607fe2e1da22b9780af19662dac939.jpg",
95
"join_requirement": 1,
96
"danmu": "老板大气!点点红包抽礼物!",
97
"awards": [{
98
"gift_id": 31212,
99
"num": 2,
100
"gift_name": "打call",
101
"gift_pic": "https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png"
102
}, {
103
"gift_id": 31214,
104
"num": 3,
105
"gift_name": "牛哇",
106
"gift_pic": "https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png"
107
}, {
108
"gift_id": 31216,
109
"num": 3,
110
"gift_name": "i了i了",
111
"gift_pic": "https://s1.hdslb.com/bfs/live/1157a445487b39c0b7368d91b22290c60fa665b2.png"
112
}],
113
"start_time": 1645358104,
114
"end_time": 1645358284,
115
"last_time": 180,
116
"remove_time": 1645358299,
117
"replace_time": 1645358294,
118
"current_time": 1645358231,
119
"lot_status": 1,
120
"h5_url": "https://live.bilibili.com/p/html/live-app-red-envelope/popularity.html?is_live_half_webview=1\u0026hybrid_half_ui=1,5,100p,100p,000000,0,50,0,0,1;2,5,100p,100p,000000,0,50,0,0,1;3,5,100p,100p,000000,0,50,0,0,1;4,5,100p,100p,000000,0,50,0,0,1;5,5,100p,100p,000000,0,50,0,0,1;6,5,100p,100p,000000,0,50,0,0,1;7,5,100p,100p,000000,0,50,0,0,1;8,5,100p,100p,000000,0,50,0,0,1\u0026hybrid_rotate_d=1\u0026hybrid_biz=popularityRedPacket\u0026lotteryId=622474",
121
"user_status": 1,
122
"lot_config_id": 3,
123
"total_price": 1600
124
}],
125
"activity_box_info": null
126
}
127
}
128
```
129
130
</details>