From 5456d130e07a74795fdc2d37f86231ff5aa4e68f Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 17 Jan 2023 02:28:43 +0800 Subject: [PATCH] fix(route): smzdm fenlei (#11630) --- lib/v2/smzdm/haowen_fenlei.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/v2/smzdm/haowen_fenlei.js b/lib/v2/smzdm/haowen_fenlei.js index c9b381cd3..1f1be35cb 100644 --- a/lib/v2/smzdm/haowen_fenlei.js +++ b/lib/v2/smzdm/haowen_fenlei.js @@ -24,18 +24,24 @@ module.exports = async (ctx) => { return { title: item.find('h2.item-name a').text(), link: item.find('h2.item-name a').attr('href'), - pubDate: timezone(parseDate(item.find('span.time').text())), + description: item.find('.item-info').html(), + author: item.find('.nickname').text(), + pubDate: timezone(parseDate(item.find('span.time').text(), ['HH:mm', 'MM-DD HH:mm', 'YYYY-MM-DD HH:mm']), 8), }; }); const out = await Promise.all( list.map((item) => ctx.cache.tryGet(item.link, async () => { - const response = await got(item.link); - const $ = cheerio.load(response.data); - item.description = $('article').html(); - item.pubDate = timezone(parseDate($('meta[property="og:release_date"]').attr('content')), 8); - item.author = $('meta[property="og:author"]').attr('content'); + try { + const response = await got(item.link); + const $ = cheerio.load(response.data); + item.description = $('article').html(); + item.pubDate = timezone(parseDate($('meta[property="og:release_date"]').attr('content')), 8); + item.author = $('meta[property="og:author"]').attr('content'); + } catch (err) { + // 404 + } return item; })