chore: format
This commit is contained in:
@@ -10,8 +10,9 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const url_list = [];
|
||||
$('[href^="/tongzhi/"]').map((_, item) => {url_list.push(baseIndexUrl + item.attribs.href);});
|
||||
|
||||
$('[href^="/tongzhi/"]').each((_, item) => {
|
||||
url_list.push(baseIndexUrl + item.attribs.href);
|
||||
});
|
||||
|
||||
const out = await Promise.all(
|
||||
url_list.map(async (news_url) => {
|
||||
@@ -21,8 +22,8 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(result.data);
|
||||
|
||||
const title = '[' + $('.over').text() + '] ' + $('div.title').text();
|
||||
const author = $('.info').text().split('|')[1].trim().substring(3,);
|
||||
const date = new Date($('.info').text().split('|')[0].trim().substring(4,)).toUTCString();
|
||||
const author = $('.info').text().split('|')[1].trim().substring(3);
|
||||
const date = new Date($('.info').text().split('|')[0].trim().substring(4)).toUTCString();
|
||||
const description = $('.content').html();
|
||||
|
||||
return {
|
||||
@@ -30,7 +31,7 @@ module.exports = async (ctx) => {
|
||||
link: news_url,
|
||||
author: author,
|
||||
pubDate: date,
|
||||
description: description
|
||||
description: description,
|
||||
};
|
||||
});
|
||||
return Promise.resolve(news_detail);
|
||||
|
||||
Reference in New Issue
Block a user