fix(route): smzdm fenlei (#11630)

This commit is contained in:
Tony 2023-01-17 02:28:43 +08:00 committed by GitHub
parent 9a56bb8803
commit 5456d130e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -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;
})