From ff254ccca1e2bb216a9167c40487fe1731bb07b3 Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Sun, 22 Sep 2024 17:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D=20wb?= =?UTF-8?q?=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=97=A0=E6=B3=95=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index 5f217b4..1deba1e 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -1300,17 +1300,18 @@ export class tools extends plugin { // 微博解析 async weibo(e) { let weiboId; + const weiboUrl = e.msg === undefined ? e.message.shift().data.replaceAll("\\", "") : e.msg.trim().replaceAll("\\", ""); // 对已知情况进行判断 - if (e.msg.includes("m.weibo.cn")) { + if (weiboUrl.includes("m.weibo.cn")) { // https://m.weibo.cn/detail/4976424138313924 - weiboId = /(?<=detail\/)[A-Za-z\d]+/.exec(e.msg)?.[0] || /(?<=m.weibo.cn\/)[A-Za-z\d]+\/[A-Za-z\d]+/.exec(e.msg)?.[0]; - } else if (e.msg.includes("weibo.com\/tv\/show") && e.msg.includes("mid=")) { + weiboId = /(?<=detail\/)[A-Za-z\d]+/.exec(weiboUrl)?.[0] || /(?<=m.weibo.cn\/)[A-Za-z\d]+\/[A-Za-z\d]+/.exec(weiboUrl)?.[0]; + } else if (weiboUrl.includes("weibo.com\/tv\/show") && weiboUrl.includes("mid=")) { // https://weibo.com/tv/show/1034:5007449447661594?mid=5007452630158934 - weiboId = /(?<=mid=)[A-Za-z\d]+/.exec(e.msg)?.[0]; + weiboId = /(?<=mid=)[A-Za-z\d]+/.exec(weiboUrl)?.[0]; weiboId = mid2id(weiboId); - } else if (e.msg.includes("weibo.com")) { + } else if (weiboUrl.includes("weibo.com")) { // https://weibo.com/1707895270/5006106478773472 - weiboId = /(?<=weibo.com\/)[A-Za-z\d]+\/[A-Za-z\d]+/.exec(e.msg)?.[0]; + weiboId = /(?<=weibo.com\/)[A-Za-z\d]+\/[A-Za-z\d]+/.exec(weiboUrl)?.[0]; } // 无法获取id就结束 if (!weiboId) {