From e494f32b14bd161dc2aeecda2415ab546ec98d20 Mon Sep 17 00:00:00 2001 From: wxs Date: Fri, 13 Mar 2026 23:52:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(pugongying):=20=E4=BF=AE=E5=A4=8D=E5=B0=8F?= =?UTF-8?q?=E7=BA=A2=E4=B9=A6=E7=9F=AD=E9=93=BE=E6=8E=A5=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xhslink.com 短链接对 HEAD 请求返回 404,且重定向 URL 在 HTML body 的 href 中而非 HTTP 302 header。改用 GET 请求并从响应体中解析真实 URL。 Co-Authored-By: Claude Opus 4.6 --- pugongying/xhs-pgy-export.user.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pugongying/xhs-pgy-export.user.js b/pugongying/xhs-pgy-export.user.js index 58bdb36..8f491f8 100644 --- a/pugongying/xhs-pgy-export.user.js +++ b/pugongying/xhs-pgy-export.user.js @@ -243,10 +243,19 @@ return; } GM_xmlhttpRequest({ - method: "HEAD", + method: "GET", url, onload(res) { - resolve(res.finalUrl || url); + if (res.finalUrl && res.finalUrl !== url) { + resolve(res.finalUrl); + return; + } + const match = res.responseText && res.responseText.match(/href="([^"]+)"/); + if (match) { + resolve(match[1].replace(/&/g, "&")); + } else { + resolve(url); + } }, onerror() { resolve(url);