Skip to content
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions lib/routes/reuters/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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: {
Expand Down Expand Up @@ -194,12 +195,6 @@

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)) {
Expand All @@ -213,7 +208,7 @@
website: 'reuters',
}),
},
headers: browserHeaders,
headerGeneratorOptions: PRESETS.MODERN_WINDOWS,
});

return {
Expand All @@ -240,7 +235,7 @@
: {}),
}),
},
headers: browserHeaders,
headerGeneratorOptions: PRESETS.MODERN_WINDOWS,
});
return {
title: response.result.section.title,
Expand Down Expand Up @@ -268,8 +263,8 @@
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,{

Check failure

Code scanning / oxlint

@stylistic(comma-spacing) Error

A space is required after ','.
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
headerGeneratorOptions: PRESETS.MODERN_WINDOWS,
});
const content = load(detailResponse.data);

Expand Down Expand Up @@ -337,7 +332,7 @@
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
Expand Down
Loading