perf(script): 优化作品 ID 提取逻辑

This commit is contained in:
Quan 2025-08-09 10:11:45 +08:00
parent 99397db7cc
commit f39f5a8552
2 changed files with 4 additions and 3 deletions

View File

@ -18,8 +18,9 @@
**用户脚本更新内容:**
**版本号2.1.0**
**版本号2.1.1**
1. 修复单张图片的作品下载后文件损坏问题
2. 脚本设置新增 `菜单始终显示` 配置项
3. 修复用户脚本 CSS 样式冲突问题
4. 优化提取作品 ID 的正则表达式

View File

@ -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
};