🐞 fix: 修复 xhs 的部分网页地址无法解析问题

This commit is contained in:
zhiyu1998 2024-11-25 20:16:22 +08:00
parent 0759de9d42
commit bce87f4d00

View File

@ -1385,7 +1385,7 @@ export class tools extends plugin {
// 一般情况下不会出现问题就使用这个正则 // 一般情况下不会出现问题就使用这个正则
id = /noteId=(\w+)/.exec(uri)?.[1] ?? verify?.[1]; id = /noteId=(\w+)/.exec(uri)?.[1] ?? verify?.[1];
// 提取 xsec_source 和 xsec_token 参数 // 提取 xsec_source 和 xsec_token 参数
xsecSource = parsedUrl.searchParams.get("xsec_source") ?? "pc_feed"; xsecSource = parsedUrl.searchParams.get("xsec_source") || "pc_feed";
xsecToken = parsedUrl.searchParams.get("xsec_token"); xsecToken = parsedUrl.searchParams.get("xsec_token");
}); });
} else { } else {
@ -1398,7 +1398,7 @@ export class tools extends plugin {
const parsedUrl = new URL(xhsUrlMatch[0]); const parsedUrl = new URL(xhsUrlMatch[0]);
id = /explore\/(\w+)/.exec(msgUrl)?.[1] || /discovery\/item\/(\w+)/.exec(msgUrl)?.[1]; id = /explore\/(\w+)/.exec(msgUrl)?.[1] || /discovery\/item\/(\w+)/.exec(msgUrl)?.[1];
// 提取 xsec_source 和 xsec_token 参数 // 提取 xsec_source 和 xsec_token 参数
xsecSource = parsedUrl.searchParams.get("xsec_source") ?? "pc_feed"; xsecSource = parsedUrl.searchParams.get("xsec_source") || "pc_feed";
xsecToken = parsedUrl.searchParams.get("xsec_token"); xsecToken = parsedUrl.searchParams.get("xsec_token");
} }
const downloadPath = `${ this.getCurDownloadPath(e) }`; const downloadPath = `${ this.getCurDownloadPath(e) }`;