From 45b8a8571b003a9945de284747e4ff6e5cadae06 Mon Sep 17 00:00:00 2001 From: dzx-dzx Date: Sat, 23 May 2026 21:49:22 +0800 Subject: [PATCH 1/3] fix(route/reuters): Adjust header --- lib/routes/reuters/common.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/routes/reuters/common.tsx b/lib/routes/reuters/common.tsx index f440cf2a011c..78734d1e4279 100644 --- a/lib/routes/reuters/common.tsx +++ b/lib/routes/reuters/common.tsx @@ -8,6 +8,7 @@ import { ViewType } from '@/types'; import cache from '@/utils/cache'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import { PRESETS } from '@/utils/header-generator'; type ReutersContent = { result: { @@ -198,6 +199,7 @@ async function handler(ctx) { Accept: 'application/json, text/plain, */*', 'Accept-Language': 'en-US,en;q=0.9', Referer: 'https://www.reuters.com/', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0', }; try { @@ -213,7 +215,7 @@ async function handler(ctx) { website: 'reuters', }), }, - headers: browserHeaders, + headerGeneratorOptions: PRESETS.MODERN_WINDOWS, }); return { @@ -240,7 +242,7 @@ async function handler(ctx) { : {}), }), }, - headers: browserHeaders, + headerGeneratorOptions: PRESETS.MODERN_WINDOWS, }); return { title: response.result.section.title, From 272d0070183201947e7c02bdeafeb64801302215 Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Mon, 25 May 2026 02:04:31 +0800 Subject: [PATCH 2/3] Update common.tsx --- lib/routes/reuters/common.tsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/routes/reuters/common.tsx b/lib/routes/reuters/common.tsx index 78734d1e4279..696c4f8e241a 100644 --- a/lib/routes/reuters/common.tsx +++ b/lib/routes/reuters/common.tsx @@ -195,13 +195,6 @@ async function handler(ctx) { const section_id = `/${category}/${topic ? `${topic}/` : ''}`; - const browserHeaders = { - Accept: 'application/json, text/plain, */*', - 'Accept-Language': 'en-US,en;q=0.9', - Referer: 'https://www.reuters.com/', - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0', - }; - try { const { title, description, rootUrl, response } = await (async () => { if (MUST_FETCH_BY_TOPICS.has(category)) { @@ -270,8 +263,8 @@ async function handler(ctx) { items.map((item) => ctx.req.query('fulltext') === 'true' ? cache.tryGet(item.link, async () => { - const detailResponse = await ofetch(item.link, { - headers: browserHeaders, + const detailResponse = await ofetch(item.link,{ + headerGeneratorOptions: PRESETS.MODERN_WINDOWS, }); const content = load(detailResponse.data); @@ -339,7 +332,7 @@ async function handler(ctx) { const arcUrl = topic ? `https://www.reuters.com/arc/outboundfeeds/v4/mobile/section${section_id}?outputType=json` : `https://www.reuters.com/arc/outboundfeeds/v4/mobile/section/${category}/?outputType=json`; const arcResponse = await ofetch(arcUrl, { - headers: browserHeaders, + headerGeneratorOptions: PRESETS.MODERN_WINDOWS, }); if (arcResponse.wireitems?.length) { const items = arcResponse.wireitems From 7ca99282d42744ff6a009ec295ccb6f1443d8af4 Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Mon, 25 May 2026 02:07:09 +0800 Subject: [PATCH 3/3] Update common.tsx --- lib/routes/reuters/common.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/reuters/common.tsx b/lib/routes/reuters/common.tsx index 696c4f8e241a..7569f87a186c 100644 --- a/lib/routes/reuters/common.tsx +++ b/lib/routes/reuters/common.tsx @@ -263,7 +263,7 @@ async function handler(ctx) { items.map((item) => ctx.req.query('fulltext') === 'true' ? cache.tryGet(item.link, async () => { - const detailResponse = await ofetch(item.link,{ + const detailResponse = await ofetch(item.link, { headerGeneratorOptions: PRESETS.MODERN_WINDOWS, }); const content = load(detailResponse.data);