Skip to content

Commit

Permalink
fix: BBC URL pathname check (DIYgod#15260)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryQW authored Apr 16, 2024
1 parent 22551e9 commit 920d1a9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/routes/bbc/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Route } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import parser from '@/utils/rss-parser';
import { load } from 'cheerio';
import utils from './utils';
import ofetch from '@/utils/ofetch';

export const route: Route = {
path: '/:site?/:channel?',
Expand Down Expand Up @@ -61,14 +61,11 @@ async function handler(ctx) {
const items = await Promise.all(
feed.items.map((item) =>
cache.tryGet(item.link, async () => {
const response = await got({
method: 'get',
url: item.link,
});
const response = await ofetch(item.link);

const $ = load(response.data);
const $ = load(response);

const description = response.request.options.url.pathname.startsWith('/news/av') ? item.content : utils.ProcessFeed($);
const description = new URL(item.link).pathname.startsWith('/news/av') ? item.content : utils.ProcessFeed($);

let section = 'sport';
const urlSplit = item.link.split('/');
Expand Down

0 comments on commit 920d1a9

Please sign in to comment.