style: auto format

This commit is contained in:
github-actions[bot] 2023-11-03 02:14:13 +00:00
parent 705ea99a1e
commit e2a15fffdc
1 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@ module.exports = async (ctx) => {
const { category, type } = ctx.params;
const rootUrl = 'https://dwxgb.bnu.edu.cn';
let currentUrl = `${rootUrl}/${category}/${type}/index.html`;
const currentUrl = `${rootUrl}/${category}/${type}/index.html`;
let response;
try {
@ -22,16 +22,16 @@ module.exports = async (ctx) => {
const $ = cheerio.load(response.data);
const list = $('ul.container.list > li')
.map((_, item) => {
const link = $(item).find('a').attr('href');
const absoluteLink = new URL(link, currentUrl).href;
return {
title: $(item).find('a').text().trim(),
pubDate: parseDate($(item).find('span').text()),
link: absoluteLink,
};
})
.get();
.map((_, item) => {
const link = $(item).find('a').attr('href');
const absoluteLink = new URL(link, currentUrl).href;
return {
title: $(item).find('a').text().trim(),
pubDate: parseDate($(item).find('span').text()),
link: absoluteLink,
};
})
.get();
const items = await Promise.all(
list.map((item) =>