Skip to content

Commit

Permalink
style: auto format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 11, 2025
1 parent b189804 commit 26acb31
Showing 1 changed file with 38 additions and 33 deletions.
71 changes: 38 additions & 33 deletions lib/routes/blizzard/news-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,44 @@ const categoryNames = {
/* 列表解析逻辑 */
const parsers = {
ow: ($) =>
$('.list-data-container .list-item-container').toArray().map((item) => {
item = $(item);
return {
title: item.find('.content-title').text(),
link: item.find('.fill-link').attr('href'),
description: item.find('.content-intro').text(),
pubDate: parseDate(item.find('.content-date').text()),
image: item.find('.item-pic').attr('src'),
};
}),
$('.list-data-container .list-item-container')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('.content-title').text(),
link: item.find('.fill-link').attr('href'),
description: item.find('.content-intro').text(),
pubDate: parseDate(item.find('.content-date').text()),
image: item.find('.item-pic').attr('src'),
};
}),
hs: ($) =>
$('.article-container>a').toArray().map((item) => {
item = $(item);
return {
title: item.find('.title').text(),
link: item.attr('href'),
description: item.find('.desc').text(),
pubDate: parseDate(item.find('.date').attr('data-time')),
image: item.find('.article-img img').attr('src'),
};
}),
wow: ($) => $('.Pane-list>a').toArray().map((item) => {
item = $(item);
return {
title: item.find('.list-title').text(),
link: item.attr('href'),
description: item.find('.list-desc').text(),
pubDate: parseDate(item.find('.list-time').attr('data-time')),
image: item.find('.img-box img').attr('src'),
};
}),
$('.article-container>a')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('.title').text(),
link: item.attr('href'),
description: item.find('.desc').text(),
pubDate: parseDate(item.find('.date').attr('data-time')),
image: item.find('.article-img img').attr('src'),
};
}),
wow: ($) =>
$('.Pane-list>a')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('.list-title').text(),
link: item.attr('href'),
description: item.find('.list-desc').text(),
pubDate: parseDate(item.find('.list-time').attr('data-time')),
image: item.find('.img-box img').attr('src'),
};
}),
};

// 详情页解析逻辑
Expand Down Expand Up @@ -113,9 +120,7 @@ async function handler(ctx) {
throw new Error('No news found');
}

const items = await Promise.all(
list.map((item) => fetchDetail(item, category))
);
const items = await Promise.all(list.map((item) => fetchDetail(item, category)));

return {
title: `${categoryNames[category]}新闻`,
Expand Down

0 comments on commit 26acb31

Please sign in to comment.