From 4408001aa34aac0524f3a3d0ecd87260d112c486 Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Sat, 17 Aug 2024 12:42:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D`?= =?UTF-8?q?=E5=BE=AE=E8=A7=86`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index 9728ca6..4f32a6c 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -171,7 +171,7 @@ export class tools extends plugin { fnc: "pixivision" }, { - reg: "(isee.weishi.qq.com)", + reg: "(weishi.qq.com)", fnc: "weishi" }, { @@ -1452,15 +1452,17 @@ export class tools extends plugin { // 微视 async weishi(e) { - // 拦截恶意链接 【后续如果有小程序检测可以删除这个逻辑】 - if (!e.msg.includes('https://isee.weishi.qq.com/ws/app-pages/share/index.html')) { - e.reply("识别:微视,但无法完整检测到视频ID"); - // 打个日志 方便后面出bug知道位置 - logger.error("[R插件][微视] 无法检测链接") - return true; - } + let url = e.msg; + const urlRegex = /https?:\/\/video\.weishi\.qq\.com\/\S+/g; + // 执行匹配 + url = url.match(urlRegex)[0]; + // 消除短链接 + await fetch(url, { + method: "HEAD" + }).then(resp => { + url = resp.url; + }); - const url = e.msg; try { const idMatch = url.match(/id=(.*)&spid/); if (!idMatch || idMatch.length !== 2) {