Merge pull request #58 from Fate2077/patch-2

哔哩哔哩解析修复
This commit is contained in:
秋刀鱼 2025-01-01 00:48:22 +08:00 committed by GitHub
commit bef9ecaf53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -149,7 +149,7 @@ export class tools extends plugin {
permission: 'master', permission: 'master',
}, },
{ {
reg: "(bilibili.com|b23.tv|t.bilibili.com|^BV[1-9a-zA-Z]{10}$)", reg: "(bilibili.com|b23.tv|bili2233.cn|t.bilibili.com|^BV[1-9a-zA-Z]{10}$)",
fnc: "bili", fnc: "bili",
}, },
{ {
@ -731,7 +731,7 @@ export class tools extends plugin {
return true; return true;
} }
const urlRex = /(?:https?:\/\/)?www\.bilibili\.com\/[A-Za-z\d._?%&+\-=\/#]*/g; const urlRex = /(?:https?:\/\/)?www\.bilibili\.com\/[A-Za-z\d._?%&+\-=\/#]*/g;
const bShortRex = /(http:|https:)\/\/b23.tv\/[A-Za-z\d._?%&+\-=\/#]*/g; const bShortRex = /(http:|https:)\/\/(b23.tv|bili2233.cn)\/[A-Za-z\d._?%&+\-=\/#]*/g;
let url = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim().replaceAll("\\", ""); let url = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim().replaceAll("\\", "");
// 直接发送BV号的处理 // 直接发送BV号的处理
if (/^BV[1-9a-zA-Z]{10}$/.exec(url)?.[0]) { if (/^BV[1-9a-zA-Z]{10}$/.exec(url)?.[0]) {
@ -739,7 +739,7 @@ export class tools extends plugin {
logger.info(url); logger.info(url);
} }
// 短号处理 // 短号处理
if (url.includes("b23.tv")) { if (url.includes("b23.tv") || url.includes("bili2233.cn")) {
const bShortUrl = bShortRex.exec(url)?.[0]; const bShortUrl = bShortRex.exec(url)?.[0];
await fetch(bShortUrl, { await fetch(bShortUrl, {
method: "HEAD" method: "HEAD"