🐞 fix: 修复 xhs 短链接无法识别问题 & 梯子判断标准修正

This commit is contained in:
zhiyu1998 2024-08-05 18:16:15 +08:00
parent d589898ffd
commit 82612e6e67
2 changed files with 3 additions and 2 deletions

View File

@ -966,13 +966,14 @@ export class tools extends plugin {
let id; let id;
if (msgUrl.includes("xhslink")) { if (msgUrl.includes("xhslink")) {
await fetch(msgUrl, { await fetch(msgUrl, {
headers: XHS_NO_WATERMARK_HEADER,
redirect: "follow", redirect: "follow",
}).then(resp => { }).then(resp => {
const uri = decodeURIComponent(resp.url); const uri = decodeURIComponent(resp.url);
// 如果出现了网页验证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 // 如果出现了网页验证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]+)/); const verify = uri.match(/\/item\/([0-9a-fA-F]+)/);
// 一般情况下不会出现问题就使用这个正则 // 一般情况下不会出现问题就使用这个正则
id = /explore\/(\w+)/.exec(uri)?.[1] ?? verify?.[1]; id = /noteId=(\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

@ -341,7 +341,7 @@ export async function testProxy(host='127.0.0.1', port=7890) {
try { try {
// 通过代理服务器发起请求 // 通过代理服务器发起请求
await axios.get('https://google.com.hk', { httpsAgent }); await axios.get('https://www.google.com', { httpsAgent });
logger.mark('[R插件][梯子测试模块] 检测到梯子'); logger.mark('[R插件][梯子测试模块] 检测到梯子');
return true; return true;
} catch (error) { } catch (error) {