🐞 fix: 修复xhs短链接解析问题

This commit is contained in:
zhiyu 2024-01-25 12:52:01 +08:00
parent 6bf9da5eb6
commit 444830003c
2 changed files with 6 additions and 3 deletions

View File

@ -71,7 +71,7 @@ export class tools extends plugin {
fnc: "literature", fnc: "literature",
}, },
{ {
reg: "^#清理data垃圾$", reg: "^清理data垃圾$",
fnc: "clearTrash", fnc: "clearTrash",
permission: "master", permission: "master",
}, },
@ -566,7 +566,10 @@ export class tools extends plugin {
redirect: "follow", redirect: "follow",
}).then(resp => { }).then(resp => {
const uri = decodeURIComponent(resp.url); const uri = decodeURIComponent(resp.url);
id = /explore\/(\w+)/.exec(uri)?.[1]; // 如果出现了网页验证uri:https://www.xiaohongshu.com/website-login/captcha?redirectPath=https://www.xiaohongshu.com/discovery/item/63c93ac3000000002203b28a?app_platform=android&app_version=8.23.1&author_share=1&ignoreEngage=true&share_from_user_hidden=true&type=normal&xhsshare=CopyLink&appuid=62c58b90000000000303dc54&apptime=1706149572&exSource=&verifyUuid=a5f32b62-453e-426b-98fe-2cfe0c16776d&verifyType=102&verifyBiz=461
const verify = uri.match(/\/item\/([0-9a-fA-F]+)/);
// 一般情况下不会出现问题就使用这个正则
id = /explore\/(\w+)/.exec(uri)?.[1] ?? verify?.[1];
}); });
} else { } else {
id = /explore\/(\w+)/.exec(msgUrl)?.[1] || /discovery\/item\/(\w+)/.exec(msgUrl)?.[1]; id = /explore\/(\w+)/.exec(msgUrl)?.[1] || /discovery\/item\/(\w+)/.exec(msgUrl)?.[1];

View File

@ -1,5 +1,5 @@
- { - {
version: 1.1.2, version: 1.1.3,
data: data:
[ [
新增<span class="cmd">快手解析</span>功能, 新增<span class="cmd">快手解析</span>功能,