From 86f4b770b8a03453f689ff8c4b903f6a53241d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E5=88=80=E9=B1=BC?= <9903082+qdyovo@user.noreply.gitee.com> Date: Mon, 30 Sep 2024 15:44:28 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20pref:=20=E5=8E=BB=E9=99=A4YouTub?= =?UTF-8?q?e=E9=93=BE=E6=8E=A5=E8=A7=A3=E6=9E=90=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index 52e5d1e..7fa0b62 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -1520,12 +1520,15 @@ export class tools extends plugin { try { const urlRex = /(?:https?:\/\/)?(www\.|music\.)?youtube\.com\/[A-Za-z\d._?%&+\-=\/#]*/g; const url2Rex = /(?:https?:\/\/)?youtu\.be\/[A-Za-z\d._?%&+\-=\/#]*/g; + //移除链接中的不需要的参数 + function removeParams(url) { + return url.replace(/&list=[^&]*/g, '').replace(/&start_radio=[^&]*/g, '').replace(/&index=[^&]*/g, ''); + } // 检测操作系统平台 const isWindows = process.platform === 'win32'; // 匹配并转义 URL 中的 & 符号(仅对 Windows 进行转义) - let url = urlRex.exec(e.msg)?.[0]?.replace(/&/g, isWindows ? '^&' : '&') || - url2Rex.exec(e.msg)?.[0]?.replace(/&/g, isWindows ? '^&' : '&'); + let url = removeParams(urlRex.exec(e.msg)?.[0] || url2Rex.exec(e.msg)?.[0]).replace(/&/g, isWindows ? '^&' : '&') //非最高画质,就按照设定的来 let graphics = "" if (this.YouTubeGraphicsOptions != 0) {