|
| 1 | +## 获取直播间内礼物 |
| 2 | + |
| 3 | +> https://api.live.bilibili.com/xlive/web-room/v1/giftPanel/roomGiftList |
| 4 | +
|
| 5 | +*请求方式:GET* |
| 6 | + |
| 7 | +认证方式:无 (无需添加Cookie) |
| 8 | + |
| 9 | +**url参数:** |
| 10 | + |
| 11 | +| 参数名 | 类型 | 内容 | 必要性 | 备注 | |
| 12 | +| -------------- | ---- | ---------- | ------ | -------------------------------- | |
| 13 | +| platform | str | web | 必要 | | |
| 14 | +| room_id | num | 主播房间号 | 必要 | | |
| 15 | +| area_parent_id | num | 直播分区 | 非必要 | 不填写可能会获取不到部分活动礼物 | |
| 16 | +| area_id | num | 直播子分区 | 非必要 | 不填写可能会获取不到部分活动礼物 | |
| 17 | + |
| 18 | +**json回复:** |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +根对象: |
| 23 | + |
| 24 | +| 字段 | 类型 | 内容 | 备注 | |
| 25 | +| ------- | ---- | -------- | ------- | |
| 26 | +| code | num | 返回值 | 0:成功 | |
| 27 | +| message | str | 错误信息 | | |
| 28 | +| data | obj | 信息本体 | | |
| 29 | + |
| 30 | +`data.gift_config.base_config.list` 数组中的对象: |
| 31 | + |
| 32 | +| 字段 | 类型 | 内容 | 备注 | |
| 33 | +| ------------------- | ---- | ------------------- | --------------------------- | |
| 34 | +| id | num | 礼物id | | |
| 35 | +| name | str | 礼物名字 | | |
| 36 | +| price | num | 该值/1000的单位为元 | | |
| 37 | +| type | num | | | |
| 38 | +| coin_type | str | 一般为gold,即电池 | | |
| 39 | +| effect | num | 特效类型? | 观察到可能出现的值为0,2,3 | |
| 40 | +| stay_time | num | 礼物展示的时间? | 均为3 | |
| 41 | +| animation_frame_num | num | 礼物动画帧数 | | |
| 42 | +| desc | str | 礼物描述 | | |
| 43 | +| img_basic | str | 礼物图片 | | |
| 44 | +| gif | str | 礼物gif动画 | | |
| 45 | + |
| 46 | +**示例:** |
| 47 | + |
| 48 | +查询`room_id=23375552`的直播间礼物信息 |
| 49 | + |
| 50 | +```shell |
| 51 | +curl 'https://api.live.bilibili.com/xlive/web-room/v1/giftPanel/roomGiftList?platform=pc&room_id=23174842' |
| 52 | +``` |
| 53 | + |
| 54 | +## 获取盲盒概率 |
| 55 | + |
| 56 | +> https://api.live.bilibili.com/xlive/general-interface/v1/blindFirstWin/getInfo |
| 57 | +
|
| 58 | +*请求方式:GET* |
| 59 | + |
| 60 | +认证方式:无 (无需添加Cookie) |
| 61 | + |
| 62 | +**url参数:** |
| 63 | + |
| 64 | +| 参数名 | 类型 | 内容 | 必要性 | 备注 | |
| 65 | +| ------- | ---- | ---- | ---------------- | ---- | |
| 66 | +| gift_id | num | | 盲盒对应的礼物id | | |
| 67 | + |
| 68 | +**json回复:** |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +根对象: |
| 73 | + |
| 74 | +| 字段 | 类型 | 内容 | 备注 | |
| 75 | +| ------- | ---- | -------- | ------- | |
| 76 | +| code | num | 返回值 | 0:成功 | |
| 77 | +| message | str | 错误信息 | | |
| 78 | +| data | obj | 信息本体 | | |
| 79 | + |
| 80 | +`data`中的对象: |
| 81 | + |
| 82 | +| 字段 | 类型 | 内容 | 备注 | |
| 83 | +| --------------- | ----- | -------- | ---- | |
| 84 | +| note_text | str | 描述 | | |
| 85 | +| blind_price | num | 盲盒价格 | | |
| 86 | +| blind_gift_name | str | 盲盒名字 | | |
| 87 | +| gifts | array | 盲盒价格 | | |
| 88 | + |
| 89 | +`gifts数组`中的对象: |
| 90 | + |
| 91 | +| 字段 | 类型 | 内容 | 备注 | |
| 92 | +| --------- | ---- | -------------- | ---- | |
| 93 | +| gift_id | num | 爆出的礼物id | | |
| 94 | +| price | num | 爆出的礼物价格 | | |
| 95 | +| gift_name | str | 礼物名字 | | |
| 96 | +| gift_img | str | 礼物图片 | | |
| 97 | +| chance | str | 概率 | | |
| 98 | + |
| 99 | +**示例:** |
| 100 | + |
| 101 | +查询`心动盲盒`的概率 |
| 102 | + |
| 103 | +```shell |
| 104 | +curl 'https://api.live.bilibili.com/xlive/general-interface/v1/blindFirstWin/getInfo?gift_id=32251' |
| 105 | +``` |
| 106 | + |
| 107 | +<details> |
| 108 | +<summary>查看响应示例:</summary> |
| 109 | + |
| 110 | +```json |
| 111 | +{ |
| 112 | + "code": 0, |
| 113 | + "message": "0", |
| 114 | + "ttl": 1, |
| 115 | + "data": { |
| 116 | + "note_text": "每日1次机会,首次投喂盲盒时享首抽福利!", |
| 117 | + "blind_price": 15000, |
| 118 | + "gifts": [ |
| 119 | + { |
| 120 | + "gift_id": 32125, |
| 121 | + "price": 2000, |
| 122 | + "gift_name": "电影票", |
| 123 | + "gift_img": "https://s1.hdslb.com/bfs/live/20864a10beaea541c7dce264d5bbc56676d63e4f.png", |
| 124 | + "is_win_gift": 0, |
| 125 | + "chance": "6%" |
| 126 | + }, |
| 127 | + { |
| 128 | + "gift_id": 32126, |
| 129 | + "price": 9000, |
| 130 | + "gift_name": "棉花糖", |
| 131 | + "gift_img": "https://s1.hdslb.com/bfs/live/b555682af41551c28f8ad19dc5c4ed87943c84f4.png", |
| 132 | + "is_win_gift": 0, |
| 133 | + "chance": "44.5%" |
| 134 | + }, |
| 135 | + { |
| 136 | + "gift_id": 32128, |
| 137 | + "price": 16000, |
| 138 | + "gift_name": "爱心抱枕", |
| 139 | + "gift_img": "https://s1.hdslb.com/bfs/live/824714c830966d7bec381e35ef808b1f478e21ee.png", |
| 140 | + "is_win_gift": 1, |
| 141 | + "chance": "45.56%" |
| 142 | + }, |
| 143 | + { |
| 144 | + "gift_id": 32281, |
| 145 | + "price": 40000, |
| 146 | + "gift_name": "绮彩权杖", |
| 147 | + "gift_img": "https://s1.hdslb.com/bfs/live/5cecbf274a4205ef76ed3f11c6540f0c6743363c.png", |
| 148 | + "is_win_gift": 1, |
| 149 | + "chance": "3.7%" |
| 150 | + }, |
| 151 | + { |
| 152 | + "gift_id": 32282, |
| 153 | + "price": 100000, |
| 154 | + "gift_name": "时空之站", |
| 155 | + "gift_img": "https://s1.hdslb.com/bfs/live/9ee53aedda3c891fdf23d35c14b3bdc4e0504a97.png", |
| 156 | + "is_win_gift": 1, |
| 157 | + "chance": "0.12%" |
| 158 | + }, |
| 159 | + { |
| 160 | + "gift_id": 34894, |
| 161 | + "price": 200000, |
| 162 | + "gift_name": "蛇形护符", |
| 163 | + "gift_img": "https://s1.hdslb.com/bfs/live/2127dd998083a8981ef4e31a4e6787ce5a4d0f9f.png", |
| 164 | + "is_win_gift": 1, |
| 165 | + "chance": "0.08%" |
| 166 | + }, |
| 167 | + { |
| 168 | + "gift_id": 32132, |
| 169 | + "price": 2233000, |
| 170 | + "gift_name": "浪漫城堡", |
| 171 | + "gift_img": "https://s1.hdslb.com/bfs/live/216fac597b3c5619d56ed332bcf5f880ea657e8e.png", |
| 172 | + "is_win_gift": 1, |
| 173 | + "chance": "0.04%" |
| 174 | + } |
| 175 | + ], |
| 176 | + "friday_yq_id": 106472, |
| 177 | + "is_first": true, |
| 178 | + "ab_res": 1, |
| 179 | + "uid": 451537183, |
| 180 | + "conf_id": 51, |
| 181 | + "pre_imgs": [ |
| 182 | + { |
| 183 | + "gift_id": 32132, |
| 184 | + "preview_url": "http://i0.hdslb.com/bfs/live/e40708d0c8ef9505027ac33ad2a17a23e8e01139.mp4" |
| 185 | + } |
| 186 | + ], |
| 187 | + "blind_gift_name": "心动盲盒" |
| 188 | + } |
| 189 | +} |
| 190 | +``` |
| 191 | +</details> |
0 commit comments