From c85ef4f3814c8a62d27cf50884688047277b0fa1 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 26 Dec 2020 14:28:03 +0800 Subject: [PATCH] chore: format --- lib/routes/universities/uestc/gr.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/routes/universities/uestc/gr.js b/lib/routes/universities/uestc/gr.js index fa82593f1..18efa7980 100644 --- a/lib/routes/universities/uestc/gr.js +++ b/lib/routes/universities/uestc/gr.js @@ -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);