🐞 fix: 修复微视

This commit is contained in:
zhiyu1998 2024-08-17 12:42:05 +08:00
parent 927b4a69fe
commit 4408001aa3

View File

@ -171,7 +171,7 @@ export class tools extends plugin {
fnc: "pixivision" fnc: "pixivision"
}, },
{ {
reg: "(isee.weishi.qq.com)", reg: "(weishi.qq.com)",
fnc: "weishi" fnc: "weishi"
}, },
{ {
@ -1452,15 +1452,17 @@ export class tools extends plugin {
// 微视 // 微视
async weishi(e) { async weishi(e) {
// 拦截恶意链接 【后续如果有小程序检测可以删除这个逻辑】 let url = e.msg;
if (!e.msg.includes('https://isee.weishi.qq.com/ws/app-pages/share/index.html')) { const urlRegex = /https?:\/\/video\.weishi\.qq\.com\/\S+/g;
e.reply("识别微视但无法完整检测到视频ID"); // 执行匹配
// 打个日志 方便后面出bug知道位置 url = url.match(urlRegex)[0];
logger.error("[R插件][微视] 无法检测链接") // 消除短链接
return true; await fetch(url, {
} method: "HEAD"
}).then(resp => {
url = resp.url;
});
const url = e.msg;
try { try {
const idMatch = url.match(/id=(.*)&spid/); const idMatch = url.match(/id=(.*)&spid/);
if (!idMatch || idMatch.length !== 2) { if (!idMatch || idMatch.length !== 2) {