diff --git a/lib/routes/reuters/common.tsx b/lib/routes/reuters/common.tsx index f440cf2a011..b230a851381 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: { @@ -194,12 +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/', - }; - try { const { title, description, rootUrl, response } = await (async () => { if (MUST_FETCH_BY_TOPICS.has(category)) { @@ -213,7 +208,7 @@ async function handler(ctx) { website: 'reuters', }), }, - headers: browserHeaders, + headerGeneratorOptions: PRESETS.MODERN_WINDOWS, }); return { @@ -240,7 +235,7 @@ async function handler(ctx) { : {}), }), }, - headers: browserHeaders, + headerGeneratorOptions: PRESETS.MODERN_WINDOWS_FIREFOX, }); return { title: response.result.section.title, @@ -269,7 +264,7 @@ async function handler(ctx) { ctx.req.query('fulltext') === 'true' ? cache.tryGet(item.link, async () => { const detailResponse = await ofetch(item.link, { - headers: browserHeaders, + headerGeneratorOptions: PRESETS.MODERN_WINDOWS, }); const content = load(detailResponse.data); @@ -337,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