From 9019b5b99e7ba20e25b6ed5d4d4c2af34df50023 Mon Sep 17 00:00:00 2001 From: Zebartin <16185081+Zebartin@users.noreply.github.com> Date: Thu, 16 May 2024 13:21:38 +0800 Subject: [PATCH] fix(route): BBC article (#15591) --- lib/routes/bbc/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/routes/bbc/index.ts b/lib/routes/bbc/index.ts index 320b85aa3..293b3c21e 100644 --- a/lib/routes/bbc/index.ts +++ b/lib/routes/bbc/index.ts @@ -61,11 +61,16 @@ async function handler(ctx) { const items = await Promise.all( feed.items.map((item) => cache.tryGet(item.link, async () => { - const response = await ofetch(item.link); + const linkURL = new URL(item.link); + if (linkURL.hostname === 'www.bbc.com') { + linkURL.hostname = 'www.bbc.co.uk'; + } + + const response = await ofetch(linkURL.href); const $ = load(response); - const path = new URL(item.link).pathname; + const path = linkURL.pathname; let description;