Skip to content

fix(route): BBC article #15591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all 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
9 changes: 7 additions & 2 deletions lib/routes/bbc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down