From f39f5a85524f7ea286a4fe711e11787dd95d8212 Mon Sep 17 00:00:00 2001 From: Quan Date: Sat, 9 Aug 2025 10:11:45 +0800 Subject: [PATCH] =?UTF-8?q?perf(script):=20=E4=BC=98=E5=8C=96=E4=BD=9C?= =?UTF-8?q?=E5=93=81=20ID=20=E6=8F=90=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/Release_Notes.md | 3 ++- static/XHS-Downloader.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/static/Release_Notes.md b/static/Release_Notes.md index 71d2456..2e6738b 100644 --- a/static/Release_Notes.md +++ b/static/Release_Notes.md @@ -18,8 +18,9 @@ **用户脚本更新内容:** -**版本号:2.1.0** +**版本号:2.1.1** 1. 修复单张图片的作品下载后文件损坏问题 2. 脚本设置新增 `菜单始终显示` 配置项 3. 修复用户脚本 CSS 样式冲突问题 +4. 优化提取作品 ID 的正则表达式 diff --git a/static/XHS-Downloader.js b/static/XHS-Downloader.js index 6fc9210..37d216a 100644 --- a/static/XHS-Downloader.js +++ b/static/XHS-Downloader.js @@ -1,7 +1,7 @@ // ==UserScript== // @name XHS-Downloader // @namespace https://github.com/JoeanAmier/XHS-Downloader -// @version 2.1.0 +// @version 2.1.1 // @description 提取小红书作品/用户链接,下载小红书无水印图文/视频作品文件 // @author JoeanAmier // @match http*://xhslink.com/* @@ -370,7 +370,7 @@ XHS-Downloader 用户脚本 详细说明: const extractName = () => { let name = document.title.replace(/ - 小红书$/, "").replace(/[^\u4e00-\u9fa5a-zA-Z0-9 ~!@#$%&()_\-+=\[\];"',.!()【】:“”,。《》?]/g, ""); name = truncateString(name, 64,); - let match = currentUrl.match(/\/([^\/]+)$/); + let match = currentUrl.match(/\/([0-9a-z]+?)\?/); let id = match ? match[1] : null; return name === "" ? id : name };