style: auto format
This commit is contained in:
parent
705ea99a1e
commit
e2a15fffdc
|
|
@ -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) =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue