fix(route/apnews): Fix page (#15808)
* fix(route/apnews): Fix page. * .
This commit is contained in:
parent
7175ab0fdd
commit
4cf8b284f2
|
|
@ -43,7 +43,7 @@ async function handler(ctx) {
|
|||
link: $(e).find('a').attr('href'),
|
||||
}))
|
||||
.filter((e) => typeof e.link === 'string')
|
||||
.map((item) => (new URL(item.link).hostname === 'apnews.com' ? fetchArticle(item) : item))
|
||||
.map((item) => fetchArticle(item))
|
||||
);
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ export function fetchArticle(item) {
|
|||
return cache.tryGet(item.link, async () => {
|
||||
const data = await ofetch(item.link);
|
||||
const $ = load(data);
|
||||
if ($('#link-ld-json').length === 0) {
|
||||
return item;
|
||||
}
|
||||
const rawLdjson = JSON.parse($('#link-ld-json').text());
|
||||
let ldjson;
|
||||
if (Array.isArray(rawLdjson)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue