From 1a60eb8a0d01606fa904726510add646bb0d687d Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Wed, 9 Oct 2024 04:13:07 +0800 Subject: [PATCH 01/12] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A3=85?= =?UTF-8?q?=E6=89=AE/=E6=94=B6=E8=97=8F=E9=9B=86=E6=90=9C=E7=B4=A2API?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=90=8D=E7=A7=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/garb/lottery.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/garb/lottery.md b/docs/garb/lottery.md index 861d874..36b2825 100644 --- a/docs/garb/lottery.md +++ b/docs/garb/lottery.md @@ -12,7 +12,7 @@ | 参数名 | 类型 | 内容 | 必要性 | 备注 | |----- |--- |------- |----- |--- | -| keyword | str | 关键词 | 不必要 | | +| key_word | str | 关键词 | 不必要 | | | ps | int | 每页返回数据的最大值 | 不必要 | | | pn | int | 当前页数 | 不必要 | | @@ -141,7 +141,7 @@ ```shell curl -G 'https://api.bilibili.com/x/garb/v2/mall/home/search' \ ---data-urlencode 'keyword=2233' \ +--data-urlencode 'key_word=2233' \ -b 'SESSDATA=xxx' ``` From 7a60bba6efe38ed87f121fb636e3139db6c8dfa0 Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Wed, 9 Oct 2024 04:21:11 +0800 Subject: [PATCH 02/12] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A3=85?= =?UTF-8?q?=E6=89=AE/=E6=94=B6=E8=97=8F=E9=9B=86=E6=90=9C=E7=B4=A2API?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E6=95=B0=E6=8D=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/garb/lottery.md | 460 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 457 insertions(+), 3 deletions(-) diff --git a/docs/garb/lottery.md b/docs/garb/lottery.md index 36b2825..5b22d56 100644 --- a/docs/garb/lottery.md +++ b/docs/garb/lottery.md @@ -137,7 +137,7 @@ **示例:** -搜索关键词为 `2233`, 然而没有结果: +搜索关键词为 `2233`: ```shell curl -G 'https://api.bilibili.com/x/garb/v2/mall/home/search' \ @@ -154,10 +154,464 @@ curl -G 'https://api.bilibili.com/x/garb/v2/mall/home/search' \ "message": "0", "ttl": 1, "data": { - "list": null, + "list": [ + { + "item_id": 0, + "name": "2024拜年纪-2233拜年画册", + "group_id": 70, + "group_name": "2024拜年纪-2233拜年画册", + "part_id": 0, + "state": "active", + "properties": { + "book_amount": "1395313", + "dlc_act_id": "279", + "dlc_act_status": "2", + "dlc_is_free": "0", + "dlc_lottery_id": "256", + "dlc_lottery_sale_quantity": "313028", + "dlc_lottery_type": "1", + "dlc_sale_end_time": "2114406245", + "dlc_sale_mode": "1", + "dlc_sale_start_time": "1707458400", + "dlc_surplus_stock": "0", + "image_cover": "http://i0.hdslb.com/bfs/archive/f96a8cf6866ccef8f54de4773acf0cb07b915ac6.png", + "sale_bp_forever_raw": "990", + "type": "dlc_act" + }, + "current_activity": null, + "next_activity": { + "type": "first_draw_discount", + "time_limit": false, + "time_left": -1728418723, + "tag": "大会员首抽", + "price_bp_month": 490, + "price_bp_forever": 490, + "type_month": "", + "tag_month": "", + "time_limit_month": false, + "time_left_month": 0 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -1728418723, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "31万+", + "total_count_desc": "已售31万+份", + "tag": "", + "jump_link": "https://www.bilibili.com/h5/mall/digital-card/home?-Abrowser=live\u0026act_id=279\u0026hybrid_set_header=2\u0026lottery_id=256", + "sales_mode": 0 + }, + { + "item_id": 0, + "name": "2024 BML\u0026BW 2233收藏集-2233福利卡池", + "group_id": 70, + "group_name": "2024 BML\u0026BW 2233收藏集-2233福利卡池", + "part_id": 0, + "state": "active", + "properties": { + "book_amount": "4376", + "dlc_act_id": "102962", + "dlc_act_status": "2", + "dlc_is_free": "1", + "dlc_lottery_id": "102966", + "dlc_lottery_sale_quantity": "2677", + "dlc_lottery_type": "2", + "dlc_sale_end_time": "1729828800", + "dlc_sale_mode": "2", + "dlc_sale_start_time": "1721876400", + "dlc_surplus_stock": "0", + "image_cover": "https://i0.hdslb.com/bfs/garb/4a374316b1e9a07cffeccbdeff585c472dcdcc26.png", + "sale_bp_forever_raw": "0", + "type": "dlc_act" + }, + "current_activity": null, + "next_activity": null, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -1728418723, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "2千+", + "total_count_desc": "已发放2千+份", + "tag": "限时DLC", + "jump_link": "https://www.bilibili.com/h5/mall/digital-card/home?-Abrowser=live\u0026act_id=102962\u0026hybrid_set_header=2\u0026lottery_id=102966", + "sales_mode": 0 + }, + { + "item_id": 0, + "name": "2233·幻境序曲-长夜", + "group_id": 70, + "group_name": "2233·幻境序曲-长夜", + "part_id": 0, + "state": "active", + "properties": { + "book_amount": "228065", + "dlc_act_id": "102161", + "dlc_act_status": "2", + "dlc_is_free": "0", + "dlc_lottery_id": "103087", + "dlc_lottery_sale_quantity": "71200", + "dlc_lottery_type": "2", + "dlc_sale_end_time": "2114406245", + "dlc_sale_mode": "1", + "dlc_sale_start_time": "1722139200", + "dlc_surplus_stock": "0", + "image_cover": "https://i0.hdslb.com/bfs/garb/f7e4f434ba6b93434b9e60df3c57a07552af4ca1.png", + "sale_bp_forever_raw": "990", + "type": "dlc_act" + }, + "current_activity": null, + "next_activity": { + "type": "first_draw_discount", + "time_limit": false, + "time_left": -1728418723, + "tag": "大会员首抽", + "price_bp_month": 490, + "price_bp_forever": 490, + "type_month": "", + "tag_month": "", + "time_limit_month": false, + "time_left_month": 0 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -1728418723, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "7万+", + "total_count_desc": "已售7万+份", + "tag": "DLC池", + "jump_link": "https://www.bilibili.com/h5/mall/digital-card/home?-Abrowser=live\u0026act_id=102161\u0026hybrid_set_header=2\u0026lottery_id=103087", + "sales_mode": 0 + }, + { + "item_id": 0, + "name": "2233·群星闪耀时-双子座", + "group_id": 70, + "group_name": "2233·群星闪耀时-双子座", + "part_id": 0, + "state": "active", + "properties": { + "book_amount": "1164544", + "dlc_act_id": "113", + "dlc_act_status": "2", + "dlc_is_free": "0", + "dlc_lottery_id": "16", + "dlc_lottery_sale_quantity": "572712", + "dlc_lottery_type": "1", + "dlc_sale_end_time": "2114406245", + "dlc_sale_mode": "1", + "dlc_sale_start_time": "1686196800", + "dlc_surplus_stock": "0", + "image_cover": "http://i0.hdslb.com/bfs/archive/ed35d12a3dce7764d6cb5b02cb4a459373472522.jpg", + "sale_bp_forever_raw": "990", + "type": "dlc_act" + }, + "current_activity": null, + "next_activity": { + "type": "first_draw_discount", + "time_limit": false, + "time_left": -1728418723, + "tag": "大会员首抽", + "price_bp_month": 90, + "price_bp_forever": 90, + "type_month": "", + "tag_month": "", + "time_limit_month": false, + "time_left_month": 0 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -1728418723, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "57万+", + "total_count_desc": "已售57万+份", + "tag": "", + "jump_link": "https://www.bilibili.com/h5/mall/digital-card/home?-Abrowser=live\u0026act_id=113\u0026hybrid_set_header=2\u0026lottery_id=16", + "sales_mode": 0 + }, + { + "item_id": 39389, + "name": "2233人生百戏-花木兰", + "group_id": 70, + "group_name": "2233人生百戏-花木兰", + "part_id": 6, + "state": "active", + "properties": { + "desc": "为从军设妙计女扮男装,涉千山越万水亲赴戎机。2233人生百戏·花木兰装扮上线啦!本套装包括动态卡片、点赞动效和表情包,永久购买还能成为认证粉丝,领取粉丝专属装扮!", + "fan_desc": "人生百戏-花木兰", + "fan_id": "人生百戏-花木兰", + "fan_item_ids": "39335,39384,39353,39354", + "fan_mid": "35365327", + "fan_no_color": "#eb3d3e", + "fan_recommend_desc": "为从军设妙计女扮男装,涉千山越万水亲赴戎机。", + "fan_recommend_jump_type": "url", + "fan_recommend_jump_value": "https://space.bilibili.com/35365327?spm_id_from=333.337.0.0", + "fan_share_image": "https://i0.hdslb.com/bfs/garb/item/5ddd3f72ef2a938e9125851f488068012b841ad4.jpg", + "gray_rule": "true", + "gray_rule_type": "all", + "image_cover": "https://i0.hdslb.com/bfs/garb/item/e21ec12047bcd93e6afb8e52a68eb9835cd54a23.jpg", + "image_cover_color": "#d8b796", + "is_hide": "false", + "item_id_card": "39334", + "item_id_emoji": "39352", + "item_id_thumbup": "39336", + "open_platform_vip_discount": "true", + "owner_uid": "647193094", + "rank_investor_show": "false", + "realname_auth": "false", + "sale_bp_forever_raw": "5000", + "sale_bp_pm_raw": "800", + "sale_buy_num_limit": "100", + "sale_quantity": "20000", + "sale_quantity_limit": "true", + "sale_region_ip_limit": "全球", + "sale_reserve_switch": "false", + "sale_time_begin": "1666868400", + "sale_type": "pay", + "suit_card_type": "big_img", + "type": "ip" + }, + "current_activity": null, + "next_activity": { + "type": "open_platform_vip_discount", + "time_limit": true, + "time_left": 417469277, + "tag": "大会员平台折扣", + "price_bp_month": 640, + "price_bp_forever": 4000, + "type_month": "open_platform_vip_discount", + "tag_month": "大会员平台折扣", + "time_limit_month": true, + "time_left_month": 417469277 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -61550323, + "sale_time_end": -1728418723, + "sale_surplus": 8650, + "sale_count_desc": "1万+", + "total_count_desc": "已售1万+份", + "tag": "", + "jump_link": "https://www.bilibili.com/h5/mall/suit/detail?navhide=1\u0026id=39389", + "sales_mode": 0 + }, + { + "item_id": 4259, + "name": "2233白色情人节", + "group_id": 70, + "group_name": "2233白色情人节", + "part_id": 6, + "state": "active", + "properties": { + "desc": "shot你的心——无论是谁都拥有爱的权利,快换上白色情人节专属装扮来遇见心里的那个ta吧!本套装包括头像挂件、动态卡片、点赞动效和表情包,永久购买还能成为认证粉丝,领取粉丝专属装扮!", + "fan_desc": "白色情人节", + "fan_id": "2233白色情人节", + "fan_item_ids": "4257,4230,4256,4255,4253,4254", + "fan_mid": "174501086", + "fan_no_color": "#f85574", + "fan_recommend_desc": "平淡日常中迎来浪漫的节日,象征爱情的丘比特们悄悄来到少女们身边,用爱之箭觉醒了懵懂悸动的心。新鲜的玫瑰,闪耀光泽的草莓,白色情人节这天为你准备不一样的惊喜。", + "fan_recommend_jump_type": "url", + "fan_recommend_jump_value": "https://b23.tv/54WVWS", + "fan_share_image": "https://i0.hdslb.com/bfs/garb/item/30e3f1b234dd33a2a5446dd7d05b31835ac74d4b.jpg", + "gray_rule": "true", + "gray_rule_type": "all", + "image_cover": "https://i0.hdslb.com/bfs/garb/item/a8d60a7d4f1f5a5de667b307736f701cb39c0741.jpg", + "image_cover_color": "#a3a8ec", + "image_cover_long": "https://i0.hdslb.com/bfs/garb/item/5ac3bb024d42ff0f26de07ce974351d62587c6ea.jpg", + "image_desc": "https://i0.hdslb.com/bfs/garb/item/cfe753a010d124a95fb311c372a5be69d82c8e13.jpg", + "is_hide": "false", + "item_id_card": "4231", + "item_id_emoji": "4252", + "item_id_pendant": "4229", + "item_id_thumbup": "4232", + "open_platform_vip_discount": "true", + "owner_uid": "647193094", + "rank_investor_show": "true", + "realname_auth": "false", + "sale_bp_forever_raw": "5900", + "sale_bp_pm_raw": "800", + "sale_buy_num_limit": "100", + "sale_quantity": "52000", + "sale_quantity_limit": "true", + "sale_region_ip_limit": "全球", + "sale_reserve_switch": "false", + "sale_time_begin": "1615694400", + "sale_type": "pay", + "suit_card_type": "big_img", + "type": "ip" + }, + "current_activity": null, + "next_activity": { + "type": "open_platform_vip_discount", + "time_limit": true, + "time_left": 417469277, + "tag": "大会员平台折扣", + "price_bp_month": 640, + "price_bp_forever": 4720, + "type_month": "open_platform_vip_discount", + "tag_month": "大会员平台折扣", + "time_limit_month": true, + "time_left_month": 417469277 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -112724323, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "5万+", + "total_count_desc": "已售5万+份", + "tag": "粉丝套装已售罄", + "jump_link": "https://www.bilibili.com/h5/mall/suit/detail?navhide=1\u0026id=4259", + "sales_mode": 0 + }, + { + "item_id": 0, + "name": "2233·少女日记-蔚蓝幻想曲", + "group_id": 70, + "group_name": "2233·少女日记-蔚蓝幻想曲", + "part_id": 0, + "state": "active", + "properties": { + "book_amount": "100310", + "dlc_act_id": "103244", + "dlc_act_status": "2", + "dlc_is_free": "0", + "dlc_lottery_id": "103885", + "dlc_lottery_sale_quantity": "16563", + "dlc_lottery_type": "2", + "dlc_sale_end_time": "2114406245", + "dlc_sale_mode": "1", + "dlc_sale_start_time": "1727236800", + "dlc_surplus_stock": "0", + "image_cover": "http://i0.hdslb.com/bfs/archive/a04b3e9ef354493a0890a9197412f1c77e01ba0f.jpg", + "sale_bp_forever_raw": "990", + "type": "dlc_act" + }, + "current_activity": null, + "next_activity": { + "type": "first_draw_discount", + "time_limit": false, + "time_left": -1728418723, + "tag": "大会员首抽", + "price_bp_month": 490, + "price_bp_forever": 490, + "type_month": "", + "tag_month": "", + "time_limit_month": false, + "time_left_month": 0 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -1728418723, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "1万+", + "total_count_desc": "已售1万+份", + "tag": "DLC池", + "jump_link": "https://www.bilibili.com/h5/mall/digital-card/home?-Abrowser=live\u0026act_id=103244\u0026hybrid_set_header=2\u0026lottery_id=103885", + "sales_mode": 0 + }, + { + "item_id": 0, + "name": "2233·少女日记-十四岁生日", + "group_id": 70, + "group_name": "2233·少女日记-十四岁生日", + "part_id": 0, + "state": "active", + "properties": { + "book_amount": "100310", + "dlc_act_id": "103244", + "dlc_act_status": "2", + "dlc_is_free": "0", + "dlc_lottery_id": "103247", + "dlc_lottery_sale_quantity": "83747", + "dlc_lottery_type": "1", + "dlc_sale_end_time": "2114406245", + "dlc_sale_mode": "1", + "dlc_sale_start_time": "1723780800", + "dlc_surplus_stock": "0", + "image_cover": "https://i0.hdslb.com/bfs/garb/9c338eb4841cad917665140cc08c7d14b5c7e0bf.png", + "sale_bp_forever_raw": "990", + "type": "dlc_act" + }, + "current_activity": null, + "next_activity": { + "type": "first_draw_discount", + "time_limit": false, + "time_left": -1728418723, + "tag": "大会员首抽", + "price_bp_month": 490, + "price_bp_forever": 490, + "type_month": "", + "tag_month": "", + "time_limit_month": false, + "time_left_month": 0 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -1728418723, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "8万+", + "total_count_desc": "已售8万+份", + "tag": "", + "jump_link": "https://www.bilibili.com/h5/mall/digital-card/home?-Abrowser=live\u0026act_id=103244\u0026hybrid_set_header=2\u0026lottery_id=103247", + "sales_mode": 0 + }, + { + "item_id": 0, + "name": "2024 BML\u0026BW 2233收藏集-BML\u0026BW2024", + "group_id": 70, + "group_name": "2024 BML\u0026BW 2233收藏集-BML\u0026BW2024", + "part_id": 0, + "state": "active", + "properties": { + "book_amount": "4376", + "dlc_act_id": "102962", + "dlc_act_status": "2", + "dlc_is_free": "0", + "dlc_lottery_id": "102963", + "dlc_lottery_sale_quantity": "1699", + "dlc_lottery_type": "1", + "dlc_sale_end_time": "2114406245", + "dlc_sale_mode": "1", + "dlc_sale_start_time": "1721876400", + "dlc_surplus_stock": "0", + "image_cover": "https://i0.hdslb.com/bfs/garb/6c2d68faf143c33b484b110e2221ab15a0a1f85c.png", + "sale_bp_forever_raw": "990", + "type": "dlc_act" + }, + "current_activity": null, + "next_activity": { + "type": "first_draw_discount", + "time_limit": false, + "time_left": -1728418723, + "tag": "大会员首抽", + "price_bp_month": 490, + "price_bp_forever": 490, + "type_month": "", + "tag_month": "", + "time_limit_month": false, + "time_left_month": 0 + }, + "current_sources": null, + "finish_sources": null, + "sale_left_time": -1728418723, + "sale_time_end": -1728418723, + "sale_surplus": 0, + "sale_count_desc": "1千+", + "total_count_desc": "已售1千+份", + "tag": "", + "jump_link": "https://www.bilibili.com/h5/mall/digital-card/home?-Abrowser=live\u0026act_id=102962\u0026hybrid_set_header=2\u0026lottery_id=102963", + "sales_mode": 0 + } + ], "pn": 1, "ps": 20, - "total": 0 + "total": 187 } } ``` From 1f4465ab5e99cff81d3e7903f3195afbb34e3826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E5=AD=90=E6=96=B9=E8=BE=B0?= Date: Sun, 17 Nov 2024 00:40:04 -0500 Subject: [PATCH 03/12] =?UTF-8?q?=E7=A6=81=E8=A8=80=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E5=8F=82=E6=95=B0hour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/live/silent_user_manage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/live/silent_user_manage.md b/docs/live/silent_user_manage.md index 08f7757..0daa299 100644 --- a/docs/live/silent_user_manage.md +++ b/docs/live/silent_user_manage.md @@ -18,6 +18,7 @@ | tuid | str | 要禁言的uid | 必要 | | | msg | str | 要禁言的弹幕内容 | 非必要 | | | mobile_app | str | web | 必要 | 定值"web"即可 | +| hour | str | 禁言时长 | 必要 | -1为永久,0为本场直播 | | csrf_token | str | CSRF Token | 必要 | cookie中的bili_jct字段 | | csrf | str | CSRF Token | 必要 | cookie中的bili_jct字段 | | visit_id | str | 不明 | 非必要 | | From 5e16f1c41d8c6a6487d9e690f0b33a6d5f072c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A9=BA=E8=8A=BD?= <74719559+emptyBud@users.noreply.github.com> Date: Sun, 19 Jan 2025 20:05:26 +0800 Subject: [PATCH 04/12] Update check_nickname.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 弃用检查昵称接口(该接口已弃用) --- docs/user/check_nickname.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/user/check_nickname.md b/docs/user/check_nickname.md index 139161b..b006dbc 100644 --- a/docs/user/check_nickname.md +++ b/docs/user/check_nickname.md @@ -1,6 +1,9 @@ # 检查昵称是否可注册 -## 检查昵称 +## ~~检查昵称(已失效)~~ + +
+查看折叠内容 > https://passport.bilibili.com/web/generic/check/nickname @@ -131,3 +134,12 @@ curl -G 'https://passport.bilibili.com/web/generic/check/nickname' \ ```
+ + + +目前该接口无论参数,稳定返回: +```json +{ + "code": 0 +} +``` From 427df2277101c9883b56f9721c2acfa66f763db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A9=BA=E8=8A=BD?= <74719559+emptyBud@users.noreply.github.com> Date: Sun, 19 Jan 2025 20:09:41 +0800 Subject: [PATCH 05/12] Update user.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 直播签到接口下线 --- docs/live/user.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/live/user.md b/docs/live/user.md index dec1db9..9a6fb5f 100644 --- a/docs/live/user.md +++ b/docs/live/user.md @@ -181,7 +181,7 @@ $.ajax({ -## 直播签到 +## ~~直播签到(已下线)~~ > https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign @@ -200,6 +200,23 @@ _请求方式:GET_ | message | str | 错误信息 | 默认为当日签到奖励内容 | | data | obj | 信息本体 | 默认为空 | +(目前已下线) + +
+查看响应示例(下线后): + +```json +{ + "code": 1, + "message": "签到活动已下线,无法使用。", + "ttl": 1, + "data": null +} +``` + +
+ + ## 本月直播签到信息 > https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/WebGetSignInfo From fab50db0394cd6e0b822dcee1534ff359079b7a0 Mon Sep 17 00:00:00 2001 From: Sparkle <16502567+zanjie1999@users.noreply.github.com> Date: Mon, 17 Feb 2025 23:18:41 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=90=88=E9=9B=86=E4=B8=AD=E7=9A=84=E8=A7=86=E9=A2=91=20?= =?UTF-8?q?=E7=9A=84api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/creativecenter/season.md | 182 ++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) diff --git a/docs/creativecenter/season.md b/docs/creativecenter/season.md index 694ff4c..55e6057 100644 --- a/docs/creativecenter/season.md +++ b/docs/creativecenter/season.md @@ -728,3 +728,185 @@ curl -X POST 'https://member.bilibili.com/x2/creative/web/season/del' \ ``` + +## 获取合集中的视频 + +可以在给合集排序时使用 + +> https://member.bilibili.com/x2/creative/web/season/section?id=3898622 + +*请求方式: POST* + +认证方式: Cookie (SESSDATA) + +**正文参数 (application/x-www-form-urlencoded):** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ----- | --- | ---- | ----- | --- | +| id | num | 合集 ID | 必要 | | + +**JSON回复:** + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ---- | +| code | num | 返回值 | 0:成功 | +| message | str | 错误信息 | | +| ttl | num | 1 | | +| data | obj | 信息本体 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| --------- | ---- | ------------ | ---- | +| seasons | obj | 合集信息 | | +| episodes | arr | 合集中的视频 | | + +`seasons`对象: + +| 字段 | 类型 | 内容 | 备注 | +| --------- | ---- | ------------ | ---- | +| id | num | 合集 ID | | +| type | num | 合集类型 | | +| cover | str | 合集封面 URL | | +| isEnd | num | 是否已完结? | 0: 未完结 | +| state | num | 合集状态? | 0: 正常显示
-6: 正在审核 | +| partState | num | 合集分段状态? | 0 | +| rejectReason | str | 合集拒绝原因? | | +| ctime | num | 创建时间 | | +| mtime | num | 修改时间 | | +| epCount | num | 视频总数 | | +| show | num | 是否公开? | 1: 公开 | +| has_charging_pay | num | 是否充电付费? | 0: 否 | + +`episodes`数组中的对象: + +| 字段 | 类型 | 内容 | 备注 | +| --------- | ---- | ------------ | ---- | +| id | num | 合集内视频 ID | | +| title | str | 视频标题 | | +| aid | num | 视频 aid | | +| bvid | str | 视频 bvid | | +| cid | num | 视频 cid | | +| seasonId | num | 合集 ID | | +| sectionId | num | 小节 ID | | +| order | num | 排序编号 | | +| videoTitle | str | 视频标题 | | +| archiveTitle | str | 看起来也是标题 | | +| archiveState | num | 0 | | +| rejectReason | str | 拒绝理由? | | +| state | num | 0 | | +| cover | str | 封面 URL | | +| is_free | num | 是否免费? | 0: 免费 | +| aid_owner | bool | 是否视频所有者 | true:是所有者 | +| charging_pay | num | 充电付费? | 0: 否 | + + +**示例:** + +获取合集176088的视频列表 `id=3541327` + +```shell +curl -X GET 'https://member.bilibili.com/x2/creative/web/season/section?id=176088' \ +-b 'SESSDATA=xxx; bili_jct=xxx' +``` + +
+查看响应示例: + +会返回全部的,由于很长,这里只保留三个作为例子 + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "section": { + "id": 176088, + "type": 1, + "seasonId": 152812, + "title": "正片", + "order": 1, + "state": 0, + "partState": 0, + "rejectReason": "", + "ctime": 1643250822, + "mtime": 1739466002, + "epCount": 112, + "cover": "http://i1.hdslb.com/bfs/archive/4439a182b142d92a169609e6e14e7217b3e14e0d.jpg", + "has_charging_pay": 0, + "Episodes": null, + "show": 1, + "has_pugv_pay": 0 + }, + "episodes": [ + { + "id": 109100674, + "title": "「开箱评测」三星Note8 EMR2笔对比公版Wacom笔 套娃笔首选 10寸 RK PX30 Wacom 电子书 天喻墨学 M2 M3", + "aid": 113997323963614, + "bvid": "BV14BNfeSE5c", + "cid": 28376042631, + "seasonId": 152812, + "sectionId": 176088, + "order": 1, + "videoTitle": "「开箱评测」三星Note8 EMR2笔对比公版Wacom笔 套娃笔首选 10寸 RK PX30 Wacom 电子书 天喻墨学 M2 M3", + "archiveTitle": "「开箱评测」三星Note8 EMR2笔对比公版Wacom笔 套娃笔首选 10寸 RK PX30 Wacom 电子书 天喻墨学 M2 M3", + "archiveState": 0, + "rejectReason": "", + "state": 0, + "cover": "", + "is_free": 0, + "aid_owner": true, + "charging_pay": 0, + "member_first": 0, + "pugv_pay": 0 + }, + { + "id": 108733886, + "title": "「开箱评测」拆解 椭圆形的第三方AirTag GRTSZ S2 Tag", + "aid": 113982291576104, + "bvid": "BV1YyNvetEbX", + "cid": 28325121446, + "seasonId": 152812, + "sectionId": 176088, + "order": 2, + "videoTitle": "「开箱评测」拆解 椭圆形的第三方AirTag GRTSZ S2 Tag", + "archiveTitle": "「开箱评测」拆解 椭圆形的第三方AirTag GRTSZ S2 Tag", + "archiveState": 0, + "rejectReason": "", + "state": 0, + "cover": "", + "is_free": 0, + "aid_owner": true, + "charging_pay": 0, + "member_first": 0, + "pugv_pay": 0 + }, + { + "id": 106045797, + "title": "「开箱评测」这帕姆怎么射不出来呢! 星穹铁道 KFC联动 财神帕姆 太可爱了", + "aid": 113892936122993, + "bvid": "BV1ZFFKeTEkr", + "cid": 28087484764, + "seasonId": 152812, + "sectionId": 176088, + "order": 3, + "videoTitle": "「开箱评测」这帕姆怎么射不出来呢! 星穹铁道 KFC联动 财神帕姆 太可爱了", + "archiveTitle": "「开箱评测」这帕姆怎么射不出来呢! 星穹铁道 KFC联动 财神帕姆 太可爱了", + "archiveState": 0, + "rejectReason": "", + "state": 0, + "cover": "", + "is_free": 0, + "aid_owner": true, + "charging_pay": 0, + "member_first": 0, + "pugv_pay": 0 + } + ] + } +} +``` + +
+ From 1f33153c0d769fa60ab709896c20d06f5dd55312 Mon Sep 17 00:00:00 2001 From: pskdje <77605497+pskdje@users.noreply.github.com> Date: Sat, 8 Mar 2025 20:09:07 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=B5=81=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复部分HTML标签未正确闭合; 修复DANMU_MSG的一个中括号方向不正确; 添加和调整了一些与登录相关的描述。 部分信息来自我写的 https://github.com/SocialSisterYi/bilibili-API-collect/issues/1139 cmd变更整理: DANMU_MSG (小) DM_INTERACTION INTERACT_WORD (小) PREPARING LIVE LOG_IN_NOTICE (新) ROOM_CHANGE ROOM_CONTENT_AUDIT_REPORT (新) CUT_OFF_V2 (新) ANCHOR_ECOLOGY_LIVING_DIALOG (新) ANCHOR_LOT_NOTICE (新) ANCHOR_BROADCAST (新) ANCHOR_HELPER_DANMU (新) PLAY_TAG (新) RECALL_DANMU_MSG (新) OTHER_SLICE_LOADING_RESULT (新) --- docs/live/message_stream.md | 909 ++++++++++++++++++++++++++++++++++-- 1 file changed, 882 insertions(+), 27 deletions(-) diff --git a/docs/live/message_stream.md b/docs/live/message_stream.md index 9533d83..7d106df 100644 --- a/docs/live/message_stream.md +++ b/docs/live/message_stream.md @@ -6,6 +6,10 @@ *请求方法: GET* +认证方式: Cookie(SESSDATA) + +可以选择进行认证,若未认证视作未登录,将会受到限制,详见后续内容。 + **URL参数:** | 参数名 | 类型 | 内容 | 必要性 | 备注 | @@ -100,7 +104,7 @@ curl -G 'https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo' \ **注: 特别的**, WS 与 WSS 连接地址带有路径 `/sub`, 如 `wss://broadcastlv.chat.bilibili.com:443/sub`. -**再注:** B 站更新了隐私政策, 连接建立 5 分钟左右, 若该连接认证时传入信息来自未登录用户, 会提示 `为保护用户隐私,未注册登陆用户将无法查看他人昵称`, 随后所有发送弹幕的用户 mid 都为 `0`, 用户名部分也使用 `*` 保护, 参见 [#732](https://github.com/SocialSisterYi/bilibili-API-collect/issues/732) +**再注:** B 站更新了隐私政策, 连接建立后, 若该连接认证时传入信息来自未登录用户, 会提示 `为保护用户隐私,未注册登陆用户将无法查看他人昵称`, 随后部分数据包(如“弹幕”、“进场或关注消息”)的用户 mid 都为 `0`, 用户名部分也使用 `*` 保护, 部分房间受到豁免, 参见 [#732](https://github.com/SocialSisterYi/bilibili-API-collect/issues/732) 操作流程 (伪代码): @@ -150,6 +154,8 @@ while (!s.isclosed()) { 注: 连接成功后 5 秒内发送, 否则强制断开连接 +再注: 若`uid`字段填写的是用户mid,则通过`获取信息流认证密钥`接口使用的认证信息所属用户mid必须与`uid`字段相同,并正确传递认证密钥,否则强制断开连接。 + **JSON正文:** 根对象: @@ -370,7 +376,7 @@ while (!s.isclosed()) { | show_player_type | num | 0? | | | user | obj | 用户相关信息 | | -`info[0[[15].extra` 表示的对象: +`info[0][15].extra` 表示的对象: 见下方 JSONC @@ -681,7 +687,7 @@ while (!s.isclosed()) { -#### 连续弹幕消息 (DM_INTERACTION) +#### 交互信息合并 (DM_INTERACTION) 注: 连续多条相同弹幕时触发 @@ -696,14 +702,21 @@ while (!s.isclosed()) { `data` 对象: -| 字段 | 类型 | 内容 | 备注 | -| ------ | ---- | -------- | ---- | -| id | num | 事件 ID | | -| status | num | 状态 | | -| type | num | 事件类型 | | -| data | str | 事件数据 | | +| 字段 | 类型 | 内容 | 备注 | +| -------- | ---- | -------- | ---- | +| id | num | 事件 ID | | +| status | num | 状态 | | +| type | num | 事件类型 | 102:弹幕
103:
104:送礼
105:分享
106:点赞 | +| data | str | 事件数据 | 一个JSON字符串 | +| dmsource | num | | | -`data.data` 对象: +`data.data` 字符串对象: + +内容格式取决于`data.type`的类型,下面将按照`data.data(类型)`进行区分标记。 + +温馨提示: 要记得先解析`data.data`内的JSON字符串,不要直接使用哦。 + +`data.data(102)` 对象: (弹幕) | 字段 | 类型 | 内容 | 备注 | | -------------------- | ----- | -------------------- | ---- | @@ -712,7 +725,7 @@ while (!s.isclosed()) { | card_appear_interval | num | 弹窗出现时间间隔 | | | send_interval | num | 发送时间间隔 | | -`data.data.combo[n]` 对象: +`data.data(102).combo[n]` 对象: | 字段 | 类型 | 内容 | 备注 | | ------------- | ---- | -------------- | ------------- | @@ -724,11 +737,48 @@ while (!s.isclosed()) { | left_duration | num | 左移时长 | | | fade_duration | num | 淡化时长 | | +`data.data(104)` 对象: (送礼) + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| fade\_duration | num | | | +| cnt | num | 投喂计数 | | +| card_appear_interval | num | | | +| suffix\_text | str | 提示文本 | `人在投喂` | +| reset\_cnt | num | | | +| display\_flag | num | | | +| gift\_id | num | 礼物 ID | | +| gift_alert_message | str | | | + +`data.data(105)` 对象: (分享) + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| fade\_duration | num | | | +| cnt | num | 分享计数 | | +| card_appear_interval | num | | | +| suffix\_text | str | 提示文本 | `人分享了直播间` | +| reset\_cnt | num | | | +| display\_flag | num | | | + +`data.data(106)` 对象: (点赞) + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| fade\_duration | num | | | +| cnt | num | 点赞计数 | | +| card_appear_interval | num | | | +| suffix\_text | str | 提示文本 | `人正在点赞` | +| reset\_cnt | num | | | +| display\_flag | num | | | + **示例:**
查看正文示例: +type===102 + ```json { "cmd": "DM_INTERACTION", @@ -756,6 +806,51 @@ while (!s.isclosed()) { } ``` +type===104 + +```json +{ + "cmd": "DM_INTERACTION", + "data": { + "data": "{\"fade_duration\":10000,\"cnt\":5,\"card_appear_interval\":0,\"suffix_text\":\"人在投喂\",\"reset_cnt\":0,\"display_flag\":1,\"gift_id\":33988,\"gift_alert_message\":\"投喂一个%s支持主播\"}", + "dmscore": 36, + "id": 85744481752576, + "status": 5, + "type": 104 + } +} +``` + +type===105 + +```json +{ + "cmd": "DM_INTERACTION", + "data": { + "data": "{\"fade_duration\":10000,\"cnt\":1,\"card_appear_interval\":0,\"suffix_text\":\"人分享了直播间\",\"reset_cnt\":0,\"display_flag\":1}", + "dmscore": 36, + "id": 85743053669888, + "status": 4, + "type": 105 + } +} +``` + +type===106 + +```json +{ + "cmd": "DM_INTERACTION", + "data": { + "data": "{\"fade_duration\":10000,\"cnt\":11,\"card_appear_interval\":0,\"suffix_text\":\"人正在点赞\",\"reset_cnt\":1,\"display_flag\":1}", + "dmscore": 36, + "id": 66159395305984, + "status": 5, + "type": 106 + } +} +``` +
#### 进场或关注消息 (INTERACT_WORD) @@ -780,7 +875,7 @@ while (!s.isclosed()) { | fans_medal | obj | 粉丝勋章 | | | identities | num | 待调查 | | | is_spread | num | 待调查 | | -| msg_type | num | 1为进场,2为关注 | | +| msg_type | num | 1为进场,2为关注,3为分享 | | | roomid | num | 房间号 | | | is_spread | num | 待调查 | | | is_spread | num | 待调查 | | @@ -1245,6 +1340,8 @@ while (!s.isclosed()) { } ``` + + #### 送礼 (SEND_GIFT) **JSON消息:** @@ -1673,7 +1770,7 @@ while (!s.isclosed()) { | ---- | ---- | ------ | --------- | | cmd | str | `NOTICE_MSG` | | | id | num | 待调查 | | -| name | str | 通知名 | | +| name | str | 通知名 | | | full | obj | 完整显示信息? | | | half | obj | 半部显示信息? | | | | side | obj | 边缘显示信息? | | @@ -1803,19 +1900,42 @@ while (!s.isclosed()) { | 字段 | 类型 | 内容 | 备注 | | ---- | ---- | ------ | --------- | | cmd | str | `PREPARING` | | -| round | num | 轮播状态:
1正在轮播
0未轮播 | | -| roomid | num | 直播间ID | 未知是真实ID还是短号 | | +| round | num | 轮播状态:
1正在轮播
0未轮播 | 开启轮播时存在 | +| roomid | str | 直播间ID | 未知是真实ID还是短号 | 类型似乎从num改为str | +| msg\_id | str | 信息id? | | +| p\_is\_ack | bool | | 未知 | +| p\_msg\_type | num | `1` | 未知 | +| send\_time | num | 发送时间 | UNIX 毫秒时间戳 | **示例:**
查看消息示例: - + +有启用轮播: + ```json { "cmd": "PREPARING", + "msg_id": "26964930181741056:1000:1000", + "p_is_ack": true, + "p_msg_type": 1, + "roomid": "1899237171", "round": 1, - "roomid": "8618057" + "send_time": 1739985402716 +} +``` + +未启用轮播: + +```json +{ + "cmd": "PREPARING", + "msg_id": "27040425357932032:1000:1000", + "p_is_ack": true, + "p_msg_type": 1, + "roomid": "1017", + "send_time": 1740129398337 } ``` @@ -1823,6 +1943,8 @@ while (!s.isclosed()) { #### 直播开始 (LIVE) +注:请求了开始直播接口、开始向服务器推流时下发。 + **JSON消息:** 根对象: @@ -1830,19 +1952,19 @@ while (!s.isclosed()) { | 字段 | 类型 | 内容 | 备注 | | --- | --- | --- | --- | | cmd | str | `LIVE` | | -| live_key | str | ? | | +| live_key | str | 标记直播场次的key | 与开始直播接口获得的live_key相同 | | voice_background | str | ? | | | sub_session_key | str | ? | | -| live_platform | str | 开播平台? | | +| live_platform | str | 开播平台? | 推测由开播接口决定 | | live_model | num | ? | | -| live_time | num | 开播时间 | UNIX 秒级时间戳 | +| live_time | num | 开播时间 | UNIX 秒级时间戳,只有请求了开始直播后立刻下发的那个数据包里存在 | | roomid | num | 直播间号 | | **示例:**
查看消息示例: - + ```json { "cmd": "LIVE", @@ -1856,6 +1978,8 @@ while (!s.isclosed()) { } ``` +
+ #### 主播信息更新 (ROOM_REAL_TIME_MESSAGE_UPDATE) **JSON消息:** @@ -2001,6 +2125,45 @@ while (!s.isclosed()) {
+#### 未登录通知 (LOG_IN_NOTICE) + +注:未使用认证信息进行登录将会下发此数据包,通常于认证包回复后下发,在后续时间里也有可能会下发;部分受到豁免的直播间不会下发。 + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `LOG_IN_NOTICE` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| notice\_msg | str | 通知内容 | | +| image\_web | str | 在网页端使用的通知图片 | | +| image\_app | str | 在app端使用的图片 | (未确认) | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "LOG_IN_NOTICE", + "data": { + "notice_msg": "为保护用户隐私,未登录无法查看他人昵称", + "image_web": "http://i0.hdslb.com/bfs/dm/75e7c16b99208df259fe0a93354fd3440cbab412.png", + "image_app": "http://i0.hdslb.com/bfs/dm/b632f7dcd3acf47deffb5f9ccc9546ae97a3415b.png" + } +} +``` + +
+ #### 用户到达直播间高能榜前三名的消息 (ONLINE_RANK_TOP3) **JSON消息:** @@ -3002,18 +3165,20 @@ while (!s.isclosed()) { | 字段 | 类型 | 内容 | 备注 | | ---------- | --- | ------ | --------- | | title | str | 直播间标题 | | -| area_id | num | 当前直播间所属分区的ID | | -| parent_area_id | num | 待调查 | | -| area_name | str | 当前直播间所属分区的名称 | | -| parent_area_name | str | 待调查 | | -| live_key | str | 待调查 | | -| sub_session_key | str | 待调查 | | +| area_id | num | 当前直播间所属二级分区的ID | | +| parent_area_id | num | 当前直播间所属一级分区的ID | | +| area_name | str | 当前直播间所属二级分区的名称 | | +| parent_area_name | str | 当前直播间所属一级分区名称 | | +| live_key | str | 标记直播场次的key | 未开播更新直播间信息时为`"0"` | +| sub_session_key | str | 待调查 | 未开播更新直播间信息时为`""`(空字符串) | **示例:**
查看消息示例: +已开播: + ```json { "cmd": "ROOM_CHANGE", @@ -3029,6 +3194,68 @@ while (!s.isclosed()) { } ``` +未开播: + +```json +{ + "cmd": "ROOM_CHANGE", + "data": { + "title": "随缘", + "area_id": 216, + "parent_area_id": 6, + "area_name": "我的世界", + "parent_area_name": "单机游戏", + "live_key": "0", + "sub_session_key": "" + } +} +``` + +
+ +#### 直播间内容审核报告 (ROOM_CONTENT_AUDIT_REPORT) + +注:这个数据包需要更新直播间标题且使用主播的登录信息才会下发,更新直播间标题后一般不会立刻下发。 + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `ROOM_CONTENT_AUDIT_REPORT` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| audit_content_type | num | 审核内容类型? | | +| room\_id | num | 直播间ID | 未知是真实ID还是短号 | +| anchor\_uid | num | 主播的用户mid | | +| audit\_status | num | 审核状态? | | +| audit\_title | str | 被审核的直播间标题 | | +| audit\_reason | str | 审核结果 | | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "ROOM_CONTENT_AUDIT_REPORT", + "data": { + "audit_content_type": 1, + "room_id": 1899237171, + "anchor_uid": 438160221, + "audit_status": 2, + "audit_title": "崩坏学园2", + "audit_reason": "一审通过" + } +} +``` +
#### 醒目留言按钮 (SUPER_CHAT_ENTRANCE) @@ -3379,6 +3606,320 @@ while (!s.isclosed()) { +#### 切断V2 (CUT_OFF_V2) + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `CUT_OFF_V2` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cut_off_scene | num | | | +| timestamp | num | 操作时间戳 | UNIX 秒时间戳 | +| cut_off_version | num | 切断提示信息版本? | | +| cut_off_data | obj | 切断提示信息 | | + +`data.cut_off_data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cut_off_title | str | 对话框窗口标题 | | +| cut\_off\_message\_list | array | 对话框正文列表 | | +| cut\_off\_tip\_list | array | 对话框提示信息列表 | | +| cut\_off\_button\_list | array | 对话框按钮列表 | | + +`data.cut_off_data.cut_off_message_list` 数组: + +| 索引 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| 0 | obj | 首个正文信息 | | +| … | obj | 单个正文信息 | | +| i | obj | 最后正文信息 | | + +`data.cut_off_data.cut_off_message_list[i]` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| type | num | 显示类别 | `1`:一个“`label`:`content`”格式的信息 | +| label | str | 标签 | | +| content | str | 内容 | | + +`data.cut_off_data.cut_off_tip_list` 数组: + +| 索引 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| 0 | obj | 首个提示行信息 | | +| … | obj | 单个提示行信息 | | +| i | obj | 最后提示行信息 | | + +`data.cut_off_data.cut_off_tip_list[i]` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| show\_platform | array | 要在哪个客户端显示的指代 | | +| message_list | array | 提示信息列表 | | + +`data.cut_off_data.cut_off_tip_list[i].message_list` 数组: + +| 索引 | 类型 | 内容 | 备注 | +|:---:| --- | --- | --- | +| 0 | obj | 首个提示组件信息 | | +| … | obj | 单个提示组件信息 | | +| i1 | obj | 最后提示组件信息 | | + +`data.cut_off_data.cut_off_tip_list[i].message_list[i1]` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| type | num | 显示类型 | `1`:纯文本
`2`:链接 | +| content | str | 显示文本 | | +| link_url | str | 链接 | type为2时有内容 | + +`data.cut_off_data.cut_off_button_list` 数组: + +| 索引 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| 0 | obj | 首个按钮信息 | | +| … | obj | 单个按钮信息 | | +| i | obj | 最后按钮信息 | | + +`data.cut_off_data.cut_off_button_list[i]` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| show_platform | array | 要在那个客户端显示的指代 | `1`和`2`可能是手机直播姬
`3`和`4`可能是pc直播姬或网页直播姬 | +| button\_text | str | 按钮文本 | | +| button\_action | num | 按钮操作 | `1`:关闭窗口?
`2`:跳转到链接? | +| button_link_url | str | 跳转链接 | | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "CUT_OFF_V2", + "data": { + "cut_off_scene": 1, + "timestamp": 1731590280, + "cut_off_version": 1, + "cut_off_data": { + "cut_off_title": "违规提示", + "cut_off_message_list": [ + { + "type": 1, + "label": "处罚结果", + "content": "切断本场直播" + }, + { + "type": 1, + "label": "违规原因", + "content": "您本场直播存在挂机、录播等消极直播行为,因此直播被切断,请您及时整改" + }, + { + "type": 1, + "label": "处罚时间", + "content": "2024年11月14日21时17分" + } + ], + "cut_off_tip_list": [ + { + "show_platform": [ + 3, + 4 + ], + "message_list": [ + { + "type": 1, + "content": "请在", + "link_url": "" + }, + { + "type": 2, + "content": "【处罚中心】", + "link_url": "https://link.bilibili.com/p/center/index?my-room/violation-records#/my-room/violation-records" + }, + { + "type": 1, + "content": "查看你的违规记录", + "link_url": "" + } + ] + } + ], + "cut_off_button_list": [ + { + "show_platform": [ + 1, + 2 + ], + "button_text": "了解详情", + "button_action": 2, + "button_link_url": "https://live.bilibili.com/p/html/live-anchor-galaxy/violation_records/mobile.html?-Abrowser=live&is_live_webview=1" + }, + { + "show_platform": [ + 3, + 4 + ], + "button_text": "我知道了", + "button_action": 1, + "button_link_url": "" + } + ] + } + } +} +``` + +
+ +#### 直播对话框 (ANCHOR_ECOLOGY_LIVING_DIALOG) + +注:推测在自动检测到画面不怎么变化且没人聊天时警告下发,见[#1139(issue正文)](https://github.com/SocialSisterYi/bilibili-API-collect/issues/1139#issue-2657488653)。 + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `ANCHOR_ECOLOGY_LIVING_DIALOG` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| dialog\_scene | num | | | +| timestamp | num | 触发时间戳 | UNIX 秒时间戳 | +| valid_timestamp | num | | | +| dialog\_top\_vertical\_img | str | | | +| dialog\_top\_landscape_img | str | | | +| dialog\_title | str | 对话框标题 | | +| dialog_message_list | array | 对话框正文列表 | 参见`CUT_OFF_V2` | +| dialog_tip_list | array | 对话框提示信息列表 | 参见`CUT_OFF_V2` | +| dialog_button_list | array | 对话框按钮列表 | 参见`CUT_OFF_V2` | + +`data.dialog_message_list` 数组: + +同`CUT_OFF_V2`的`data.cut_off_data.cut_off_message_list`数组。 + +`data.dialog_tip_list` 数组: + +同`CUT_OFF_V2`的`data.cut_off_data.cut_off_tip_list`数组。 + +`data.dialog_button_list` 数组: + +同`CUT_OFF_V2`的`data.cut_off_data.cut_off_button_list`数组。 + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "ANCHOR_ECOLOGY_LIVING_DIALOG", + "data": { + "dialog_scene": 1, + "timestamp": 1731504845, + "valid_timestamp": 0, + "dialog_top_vertical_img": "https://i0.hdslb.com/bfs/live/ee359d3e89bb044914f72a557a4ac2d3b5ba4004.png", + "dialog_top_landscape_img": "https://i0.hdslb.com/bfs/live/ee359d3e89bb044914f72a557a4ac2d3b5ba4004.png", + "dialog_title": "直播间违规", + "dialog_message_list": [ + { + "type": 1, + "label": "处罚结果", + "content": "警告" + }, + { + "type": 1, + "label": "违规原因", + "content": "您本场直播存在挂机、录播等消极直播行为,请及时整改" + }, + { + "type": 1, + "label": "处罚时间", + "content": "2024年11月13日21时34分" + } + ], + "dialog_tip_list": [ + { + "show_platform": [ + 1, + 2 + ], + "message_list": [ + { + "type": 1, + "content": "请在", + "link_url": "" + }, + { + "type": 2, + "content": "【处罚中心】", + "link_url": "https://live.bilibili.com/p/html/live-anchor-galaxy/violation_records/mobile.html?is_live_half_webview=1u0026hybrid_rotate_d=1u0026is_cling_player=1u0026hybrid_half_ui=1,3,100p,70p,0,1,30,100;2,2,375,100p,0,1,30,100;3,3,100p,70p,0,1,30,100;4,2,375,100p,0,1,30,100;5,3,100p,70p,0,1,30,100;6,3,100p,70p,0,1,30,100;7,3,100p,70p,0,1,30,100;8,3,100p,70p,0,1,30,100#/" + }, + { + "type": 1, + "content": "查看你的违规记录", + "link_url": "" + } + ] + }, + { + "show_platform": [ + 3, + 4 + ], + "message_list": [ + { + "type": 1, + "content": "请在", + "link_url": "" + }, + { + "type": 2, + "content": "【处罚中心】", + "link_url": "https://link.bilibili.com/#/my-room/violation-records?jump_type=browser&app_common=open" + }, + { + "type": 1, + "content": "查看你的违规记录", + "link_url": "" + } + ] + } + ], + "dialog_button_list": [ + { + "show_platform": [ + 1, + 2, + 3, + 4 + ], + "button_text": "我知道了", + "button_action": 1, + "button_link_url": "" + } + ] + } +} +``` + +
+ #### 直播间背景图片修改 (CHANGE_ROOM_INFO) **JSON消息:** @@ -3798,6 +4339,55 @@ while (!s.isclosed()) { +#### 天选时刻通知 (ANCHOR_LOT_NOTICE) + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `ANCHOR_LOT_NOTICE` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| notice\_type | num | 通知卡片类型? | | +| lottery\_card | obj | 通知卡片内容 | | + +`data.lottery_card` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| show\_time | num | 显示时间? | | +| button\_text | str | 按钮文本? | | +| icon | str | 图标 | | +| title | str | 标题? | | + +**示例:** + +
+查看消息示例: + +```json +{ + "data": { + "notice_type": 1, + "lottery_card": { + "show_time": 30, + "button_text": "去发奖", + "icon": "https://i0.hdslb.com/bfs/live/95970204111233f181fc28622502aaf1a9359b9a.png", + "title": "发天选有助于人气累积" + } + }, + "cmd": "ANCHOR_LOT_NOTICE" +} +``` + +
+ #### 邀请视频连线 (VIDEO_CONNECTION_JOIN_START) **示例:** @@ -3935,3 +4525,268 @@ while (!s.isclosed()) { ``` + +#### 直播小助手? (ANCHOR_BROADCAST) + +第一次达到了某种条件下发。 + +已知当在一个分区(中途不能切换)开播时长达到150、180、200、300分钟可能下发,直播间初次被分享1~2次时下发。 + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `ANCHOR_BROADCAST` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| sender | str | 标题? | `直播小助手` | +| msg | str | 提示消息 | | +| platform | num | 平台标识? | `0` | +| button\_info | obj | 按钮信息? | | +| milestone\_type | str | 里程碑类型? | `session_livetime`,`first_share`,`session_share` | +| milestone\_value | num | 里程值? | | +| milestone\_index | num | 里程碑类型的索引? | `1`,`5`,`6`,`7` | + +`data.button_info` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| button\_name | str | | | +| blink_button_type | str | | | +| blink_button_target | str | | | +| blink_button_extra | str | | | +| blink_button_label | num | | | +| hime_button_type | str | | | +| hime_button_target | str | | | +| hime_button_extra | str | | | +| hime\_button\_h5\_type | str | | | +| hime_button_label | num | | | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "ANCHOR_BROADCAST", + "data": { + "sender": "直播小助手", + "msg": "恭喜你,开播时长达到180分钟!", + "platform": 0, + "button_info": { + "button_name": "", + "blink_button_type": "", + "blink_button_target": "", + "blink_button_extra": "", + "blink_button_label": 0, + "hime_button_type": "", + "hime_button_target": "", + "hime_button_extra": "", + "hime_button_h5_type": "", + "hime_button_label": 0 + }, + "milestone_type": "session_livetime", + "milestone_value": 10800, + "milestone_index": 6 + } +} +``` + +
+ +#### 直播小助手? (ANCHOR_HELPER_DANMU) + +几乎与`ANCHOR_BROADCAST`一同下发。 + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `ANCHOR_HELPER_DANMU` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| sender | str | 标题? | `直播小助手` | +| msg | str | 提示消息 | | +| platform | num | 平台标识? | | +| button\_platform | num | | | +| button\_name | str | | | +| button\_target | str | | | +| button\_label | num | | | +| report\_type | str | 上报类型? | | +| report | str | | | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "ANCHOR_HELPER_DANMU", + "data": { + "sender": "直播小助手", + "msg": "恭喜你,开播时长达到150分钟!", + "platform": 3, + "button_platform": 0, + "button_name": "", + "button_target": "", + "button_label": 0, + "report_type": "milestone", + "report": "session_livetime:5:9000" + } +} +``` + +
+ +#### 直播进度条节点标签 (PLAY_TAG) + +注: 在特定直播间的特定情况下发。 + +例如: 在[直播间6](https://live.bilibili.com/6)内,有人打出了某种操作。 + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `PLAY_TAG` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| tag\_id | num | 标签 ID | | +| pic | str | 标签图标 | 通常显示于进度条之上 | +| timestamp | num | UNIX 秒时间戳 | | +| type | str | 操作类型 | `ADD`:添加 | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "PLAY_TAG", + "data": { + "tag_id": 367751, + "pic": "https://i0.hdslb.com/bfs/live/0e04525fee9ea6ea6973e8bd1116d9f1f6501d37.png", + "timestamp": 1740319807, + "type": "ADD" + } +} +``` + +
+ +#### ??? (RECALL_DANMU_MSG) + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `RECALL_DANMU_MSG` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| recall_type | num | 类型? | `2` | +| target_id | num | | | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "RECALL_DANMU_MSG", + "data": { + "recall_type": 2, + "target_id": 525503743 + } +} +``` + +
+ +#### 直播剪辑 (OTHER_SLICE_LOADING_RESULT) + +注: 点击剪辑按钮后的几秒内下发,目前只有网页端有这个按钮,且部分直播间可用(2025-02-20记录)。 + +**JSON消息:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| cmd | str | `OTHER_SLICE_LOADING_RESULT` | | +| data | obj | 信息本体 | | + +`data` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| data | array | 剪辑片段数据 | | +| live_key | str | 标记直播场次的key | 未验证真实性 | + +`data.data` 数组: + +| 索引 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| 0 | obj | 单个片段数据 | | + +`data.data[i]` 对象: + +| 字段 | 类型 | 内容 | 备注 | +| --- | --- | --- | --- | +| start\_time | num | 片段开始时间时间戳 | UNIX 秒时间戳 | +| end\_time | num | 片段结束时间时间戳 | UNIX 秒时间戳 | +| stream | str | 从开始时间到结束时间内的直播视频片段 | 需要使用浏览器用户代理字符串,特别是m3u文件内的视频链接 | +| type | num | 类型? | | +| ban\_ec | bool | ? | | + +**示例:** + +
+查看消息示例: + +```json +{ + "cmd": "OTHER_SLICE_LOADING_RESULT", + "data": { + "data": [ + { + "start_time": 1740037738, + "end_time": 1740038916, + "stream": "https://jssz-boss.hdslb.com/live2arc_anchor_video/vod_579433011406177273.m3u?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=y4zI4XTQzlOkmSKg%2F20250220%2Fjssz%2Fs3%2Faws4_request&X-Amz-Date=20250220T080858Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=52be315e8e7def8e11f86d3c6d4952362725c3c087a433780926bc0e8c88c2e1", + "type": 0, + "ban_ec": false + } + ], + "live_key": "579433011406177273" + } +} +``` + +
From 14670917f7ba9da5304b218927f5c526b154644f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E5=8F=AA=E5=B0=8F=E5=8C=85=E5=AD=90?= <1601302408@qq.com> Date: Fri, 21 Mar 2025 17:07:45 +0800 Subject: [PATCH 08/12] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=85=E8=8E=B7?= =?UTF-8?q?=E5=8F=96AI=E6=80=BB=E7=BB=93=E5=86=85=E5=AE=B9API=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=9A=84Cookie=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/video/summary.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/video/summary.md b/docs/video/summary.md index b75e6e3..e7da86f 100644 --- a/docs/video/summary.md +++ b/docs/video/summary.md @@ -8,6 +8,8 @@ *请求方式: GET* +认证方式:Cookie(SESSDATA) + 鉴权方式:[Wbi 签名](../misc/sign/wbi.md) **url参数:** @@ -27,7 +29,7 @@ | 字段 | 类型 | 内容 | 备注 | |---------|-----|------|--------------------------| -| code | num | 返回值 | 0: 成功
-400:请求错误
-403: 访问权限不足 | +| code | num | 返回值 | 0: 成功
-101: 账号未登录
-400:请求错误
-403: 访问权限不足 | | message | str | 错误信息 | 默认为0 | | ttl | num | 1 | | | data | obj | 数据本体 | | From 40eb44fd66cbdc80377fdce57b96cd7cd7b60f2a Mon Sep 17 00:00:00 2001 From: YuHuanTin <51024916+YuHuanTin@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:14:03 +0800 Subject: [PATCH 09/12] Update manage.md --- docs/live/manage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/live/manage.md b/docs/live/manage.md index 319487f..2111097 100644 --- a/docs/live/manage.md +++ b/docs/live/manage.md @@ -152,7 +152,7 @@ curl 'https://api.live.bilibili.com/room/v1/Room/update' \ | -------- | ---- | ------------------------ | ------ | ----------------------------------- | | room_id | num | 直播间id | 必要 | 必须为自己的直播间id | | area_v2 | num | 直播分区id(子分区id) | 必要 | 详见[直播分区](live_area.md) | -| platform | str | 直播平台 | 必要 | web端:
bililink:android_link | +| platform | str | 直播平台 | 必要 | 直播姬(pc):pc_link
web端:
bililink:android_link | | csrf | str | CSRF Token(位于cookie) | 必要 | | **json回复:** From b2a368bfe12584dc8860e7c50fbd2b7ed4dc8c52 Mon Sep 17 00:00:00 2001 From: z0z0r4 Date: Sun, 13 Apr 2025 09:46:30 +0800 Subject: [PATCH 10/12] Update silent_user_manage.md --- docs/live/silent_user_manage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/live/silent_user_manage.md b/docs/live/silent_user_manage.md index 0daa299..a94146f 100644 --- a/docs/live/silent_user_manage.md +++ b/docs/live/silent_user_manage.md @@ -18,7 +18,7 @@ | tuid | str | 要禁言的uid | 必要 | | | msg | str | 要禁言的弹幕内容 | 非必要 | | | mobile_app | str | web | 必要 | 定值"web"即可 | -| hour | str | 禁言时长 | 必要 | -1为永久,0为本场直播 | +| hour | num | 禁言时长 | 必要 | -1为永久,0为本场直播 | | csrf_token | str | CSRF Token | 必要 | cookie中的bili_jct字段 | | csrf | str | CSRF Token | 必要 | cookie中的bili_jct字段 | | visit_id | str | 不明 | 非必要 | | From 4abf38f2aa66f38fc4041cb8eb9ad850679281a7 Mon Sep 17 00:00:00 2001 From: Seamain Date: Sun, 13 Apr 2025 11:22:43 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BC=98=E5=8C=96wbi.md=E9=87=8C?= =?UTF-8?q?=E7=9A=84Swift=E4=BB=A3=E7=A0=81=20(#1208)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复Swift代码中时间戳类型转化后多出.0的问题 --- docs/misc/sign/wbi.md | 68 ++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/docs/misc/sign/wbi.md b/docs/misc/sign/wbi.md index dacbb28..0376979 100644 --- a/docs/misc/sign/wbi.md +++ b/docs/misc/sign/wbi.md @@ -1108,9 +1108,9 @@ mod tests { 需要 [Alamofire](https://github.com/Alamofire/Alamofire) 和 [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON) 库 ```swift -import Foundation -import CommonCrypto import Alamofire +import CommonCrypto +import Foundation import SwiftyJSON func biliWbiSign(param: String, completion: @escaping (String?) -> Void) { @@ -1124,35 +1124,39 @@ func biliWbiSign(param: String, completion: @escaping (String?) -> Void) { let currTime = round(Date().timeIntervalSince1970) params["wts"] = currTime params = params.sorted { $0.key < $1.key }.reduce(into: [:]) { $0[$1.key] = $1.value } - params = params.mapValues { String(describing: $0).filter { !"!'()*".contains($0) } } + params = params.mapValues { value in + if let doubleValue = value as? Double, doubleValue.truncatingRemainder(dividingBy: 1) == 0 { + return String(Int(doubleValue)).filter { !"!'()*".contains($0) } + } + return String(describing: value).filter { !"!'()*".contains($0) } + } let query = params.map { "\($0.key)=\($0.value)" }.joined(separator: "&") let wbiSign = calculateMD5(string: query + mixinKey) params["w_rid"] = wbiSign return params } - func getWbiKeys(completion: @escaping (Result<(imgKey: String, subKey: String), Error>) -> Void) { - let headers: HTTPHeaders = [ - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", - "Referer": "https://www.bilibili.com/" - ] + func getWbiKeys(completion: @escaping (Result<(imgKey: String, subKey: String), Error>) -> Void) { + let headers: HTTPHeaders = [ + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", + "Referer": "https://www.bilibili.com/" + ] - AF.request("https://api.bilibili.com/x/web-interface/nav", headers: headers).responseJSON { response in - switch response.result { - case .success(let value): - let json = JSON(value) - let imgURL = json["data"]["wbi_img"]["img_url"].string ?? "" - let subURL = json["data"]["wbi_img"]["sub_url"].string ?? "" - let imgKey = imgURL.components(separatedBy: "/").last?.components(separatedBy: ".").first ?? "" - let subKey = subURL.components(separatedBy: "/").last?.components(separatedBy: ".").first ?? "" - completion(.success((imgKey, subKey))) - case .failure(let error): - completion(.failure(error)) - } - } - } + AF.request("https://api.bilibili.com/x/web-interface/nav", headers: headers).responseJSON { response in + switch response.result { + case .success(let value): + let json = JSON(value) + let imgURL = json["data"]["wbi_img"]["img_url"].string ?? "" + let subURL = json["data"]["wbi_img"]["sub_url"].string ?? "" + let imgKey = imgURL.components(separatedBy: "/").last?.components(separatedBy: ".").first ?? "" + let subKey = subURL.components(separatedBy: "/").last?.components(separatedBy: ".").first ?? "" + completion(.success((imgKey, subKey))) + case .failure(let error): + completion(.failure(error)) + } + } + } - func calculateMD5(string: String) -> String { let data = Data(string.utf8) var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH)) @@ -1174,7 +1178,7 @@ func biliWbiSign(param: String, completion: @escaping (String?) -> Void) { case .success(let keys): let spdParam = param.components(separatedBy: "&") var spdDicParam = [String: String]() - spdParam.forEach { pair in + for pair in spdParam { let components = pair.components(separatedBy: "=") if components.count == 2 { spdDicParam[components[0]] = components[1] @@ -1191,6 +1195,22 @@ func biliWbiSign(param: String, completion: @escaping (String?) -> Void) { } } +// 使用示例 +biliWbiSign(param: "bar=514&foo=114&zab=1919810") { + signedQuery in + if let signedQuery = signedQuery { + print("签名后的参数: \(signedQuery)") + } else { + print("签名失败") + } +} + +RunLoop.main.run()//程序类型为命令行程序时需要添加这行代码 + +``` + +```text +签名后的参数: bar=514&wts=1741082093&foo=114&zab=1919810&w_rid=04775bb3debbb45bab86a93a1c08d12a ``` From 1e1e9ed859f708c7e15c69a728f7f0a09ccc9526 Mon Sep 17 00:00:00 2001 From: stmtc233 <69023595+stmtc233@users.noreply.github.com> Date: Sun, 13 Apr 2025 11:26:33 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0"=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=AF=8F=E6=97=A5=E6=8A=95=E5=B8=81=E8=8E=B7=E5=BE=97=E7=BB=8F?= =?UTF-8?q?=E9=AA=8C=E6=95=B0"=20(#1162)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update member_center.md * Update member_center.md --- docs/login/member_center.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/login/member_center.md b/docs/login/member_center.md index 89b0f81..226d8d2 100644 --- a/docs/login/member_center.md +++ b/docs/login/member_center.md @@ -138,14 +138,14 @@ curl 'https://api.bilibili.com/x/member/web/exp/reward' \ ## 查询每日投币获得经验数 ->https://www.bilibili.com/plus/account/exp.php +> ~~https://www.bilibili.com/plus/account/exp.php~~ (已失效) +> +> https://api.bilibili.com/x/web-interface/coin/today/exp *请求方式:GET* 认证方式:仅可Cookie(SESSDATA) -鉴权方式:Cookie中`DedeUserID`存在且不为0 - 该接口实时更新,未发现延迟 **json回复:** @@ -156,13 +156,13 @@ curl 'https://api.bilibili.com/x/member/web/exp/reward' \ | ------- | ---- | -------------------- | ----------- | | code | num | 返回值 | 0:成功 | | message | str | 错误信息 | 默认为0 | -| number | num | 每日投币所奖励的经验 | 上限为50 | +| data | num | 每日投币所奖励的经验 | 上限为50 | **示例:** ```shell -curl 'https://www.bilibili.com/plus/account/exp.php' \ --b 'SESSDATA=xxx;DedeUserID=1' +curl 'https://api.bilibili.com/x/web-interface/coin/today/exp' \ +-b 'SESSDATA=xxx' ```
@@ -172,7 +172,8 @@ curl 'https://www.bilibili.com/plus/account/exp.php' \ { "code": 0, "message": "0", - "number": 20 + "ttl": 1, + "data": 20 } ```