Skip to content

Commit

Permalink
chore: fix code for ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangpeng2k committed Jan 8, 2025
1 parent 9654fb3 commit d74b6b8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/routes/blizzard/news-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const parsers = {
image: item.find('.item-pic').attr('src'),
};
}),
hs: ($) =>
hs: ($) =>
$('.article-container>a').toArray().map((item) => {
item = $(item);
return {
Expand Down Expand Up @@ -87,17 +87,13 @@ function getList(category, $) {
}

async function fetchDetail(item, category) {
return cache.tryGet(item.link, async () => {
return await cache.tryGet(item.link, async () => {
const response = await ofetch(item.link);
const $ = load(response);

const parseDetail = detailParsers[category];
if (parseDetail) {
item.description = parseDetail($);
} else {
item.description = '无法解析详情内容';
}

item.description = parseDetail($);

return item;
});
}
Expand Down Expand Up @@ -137,6 +133,7 @@ async function handler(ctx) {
item: items,
};
} catch (error) {
console.error('抓取新闻时出错。'+error);
return {
title: `${categoryNames[category]}新闻`,
description: '抓取新闻时出错。',
Expand Down

0 comments on commit d74b6b8

Please sign in to comment.