From 24bb343e59386e0de981bbf5fd7b0b91298376bd Mon Sep 17 00:00:00 2001 From: zhiyu1998 Date: Mon, 10 Apr 2023 23:16:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8Dnetease?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E7=9A=84=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/neteasepro.js | 2 +- apps/tools.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/neteasepro.js b/apps/neteasepro.js index a77eeca..b7d0a93 100644 --- a/apps/neteasepro.js +++ b/apps/neteasepro.js @@ -247,7 +247,7 @@ export class neteasepro extends plugin { // 非小程序 const title = await getSongDetail(id).then(res => { const song = res.songs?.[0]; - return song.length > 0 + return song?.length > 0 ? `${song?.name}-${song?.ar?.[0].name}`.replace(/[\/\?<>\\:\*\|".… ]/g, "") : "暂无信息"; }); diff --git a/apps/tools.js b/apps/tools.js index 8bce1ea..384dba1 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -793,17 +793,18 @@ export class tools extends plugin { // 小红书解析 async redbook(e) { - // 解析短号 + // 正则说明:匹配手机链接、匹配小程序、匹配PC链接 let msgUrl = - /(http:|https:)\/\/(xhslink|xiaohongshu).com\/[A-Za-z\d._?%&+\-=\/#@]*/.exec( - e.msg, - )?.[0] + /(http:|https:)\/\/(xhslink|xiaohongshu).com\/[A-Za-z\d._?%&+\-=\/#@]*/.exec( + e.msg, + )?.[0] || /(http:|https:)\/\/www\.xiaohongshu\.com\/discovery\/item\/(\w+)/.exec( e.message[0].data, )?.[0] || /(http:|https:)\/\/www\.xiaohongshu\.com\/explore\/(\w+)/.exec( e.msg, )?.[0] + // 解析短号 let id; if (msgUrl.includes("xhslink")) { await fetch(msgUrl, {