mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
修复B站转发卡片BUG
1. 最新URL `https://b23.tv/nz4tMtX` 返回 ``` HTTP/2 301 date: Tue, 31 Jan 2023 09:43:07 GMT content-type: text/html; charset=utf-8 content-length: 781 set-cookie: ******; path=/; expires=Mon, 27 Oct 2025 09:43:07 GMT; domain=.bilibili.com set-cookie: b_nut=1675158187; path=/; expires=Wed, 31 Jan 2024 09:43:07 GMT; domain=.bilibili.com location: /video/BV1CM4y197A4/?buvid=****** vary: Origin,Accept-Encoding idc: shjd x-cache-webcdn: BYPASS from blzone07 ``` 这时候 url 会变成 `/video/BV1CM4y197A4/` 需要去除末尾的/来提取BVID 2. 某些转发(比如ios客户端)目前QQ小程序的desc为空,需要在prompt里检测 ```json [CQ:json,data={"app":"com.tencent.miniapp_01","appID":"100951776","bthirdappforward":true,"bthirdappforwardforbackendswitch":true,"config":{"autoSize":0,"ctime":1675159871,"forward":1,"height":0,"token":"d1dda06f69b12d511972e87ec49b2a19","type":"normal","width":0},"desc":"","extra":{"app_type":1,"appid":100951776,"uin":28696786},"meta":{"detail_1":{"appType":0,"appid":"1109937557","desc":"网络中挖到国防光缆vs现实","gamePoints":"","gamePointsUrl":"","host":{"nick":"Noahzark","uin":28696786},"icon":"http://miniapp.gtimg.cn/public/appicon/432b76be3a548fc128acaa6c1ec90131_200.jpg","preview":"https://pic.ugcimg.cn/07cc5adddb5e6ef3cc27326a12b2df17/jpg1","qqdocurl":"https://b23.tv/******","scene":1036,"shareTemplateData":{},"shareTemplateId":"8C8E89B49BE609866298ADDFF2DBABA4","showLittleTail":"","title":"哔哩哔哩","url":"m.q.qq.com/a/s/f6362a996fd107b3d4dbedce09c17d92"}},"prompt":"[QQ小程序]哔哩哔哩","ver":"1.0.1.42","view":"view_8C8E89B49BE609866298ADDFF2DBABA4"}] ```
This commit is contained in:
parent
f39005f5e1
commit
5ddfd2b5b9
@ -55,7 +55,7 @@ async def _(event: GroupMessageEvent):
|
||||
data = None
|
||||
if data:
|
||||
# 转发视频
|
||||
if data.get("desc") == "哔哩哔哩":
|
||||
if data.get("desc") == "哔哩哔哩" or data.get('prompt').find('哔哩哔哩') != -1:
|
||||
async with aiohttp.ClientSession(
|
||||
headers=get_user_agent()
|
||||
) as session:
|
||||
@ -64,6 +64,8 @@ async def _(event: GroupMessageEvent):
|
||||
timeout=7,
|
||||
) as response:
|
||||
url = str(response.url).split("?")[0]
|
||||
if url[-1] == '/':
|
||||
url = url[:-1]
|
||||
bvid = url.split("/")[-1]
|
||||
vd_info = await video.get_video_base_info(bvid)
|
||||
# 转发专栏
|
||||
|
||||
Loading…
Reference in New Issue
Block a user