fix(route/reuters): Fix empty authors & prevent unintended fallback (#21256)

* fix(route/reuters): Fix empty authors & prevent unintended fallback

* Update lib/routes/reuters/common.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix error handling for FetchError in common.tsx

* Update common.tsx

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Andvari 2026-03-02 03:09:53 +08:00 committed by GitHub
parent 1520f4f30c
commit 2f9d18ccea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -257,7 +257,7 @@ async function handler(ctx) {
guid: e.id,
pubDate: parseDate(e.published_time),
updated: parseDate(e.updated_time),
author: e.authors.map((e) => e.name).join(', '),
author: e.authors?.map((e) => e.name).join(', '),
category: e.kicker.names,
description: e.description,
}));
@ -329,7 +329,8 @@ async function handler(ctx) {
link: `https://www.reuters.com${section_id}`,
item: items,
};
} catch {
} catch (error: any) {
if (error?.name !== 'FetchError') { throw error; }
// Fallback to arc outboundfeeds if API fails
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`;