From 82612e6e670addad3f2ec4cda66d84cc57e2c1bf Mon Sep 17 00:00:00 2001 From: zhiyu1998 <542716863@qq.com> Date: Mon, 5 Aug 2024 18:16:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D=20`xhs?= =?UTF-8?q?`=20=E7=9F=AD=E9=93=BE=E6=8E=A5=E6=97=A0=E6=B3=95=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E9=97=AE=E9=A2=98=20&=20=E6=A2=AF=E5=AD=90=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=A0=87=E5=87=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tools.js | 3 ++- utils/common.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/tools.js b/apps/tools.js index e033661..e74cb92 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -966,13 +966,14 @@ export class tools extends plugin { let id; if (msgUrl.includes("xhslink")) { await fetch(msgUrl, { + headers: XHS_NO_WATERMARK_HEADER, redirect: "follow", }).then(resp => { 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 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 { id = /explore\/(\w+)/.exec(msgUrl)?.[1] || /discovery\/item\/(\w+)/.exec(msgUrl)?.[1]; diff --git a/utils/common.js b/utils/common.js index a42fccd..cadf7af 100644 --- a/utils/common.js +++ b/utils/common.js @@ -341,7 +341,7 @@ export async function testProxy(host='127.0.0.1', port=7890) { try { // 通过代理服务器发起请求 - await axios.get('https://google.com.hk', { httpsAgent }); + await axios.get('https://www.google.com', { httpsAgent }); logger.mark('[R插件][梯子测试模块] 检测到梯子'); return true; } catch (error) {