mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix: aliyun-kernel pub time error (#3750)
This commit is contained in:
@@ -14,21 +14,20 @@ module.exports = async (ctx) => {
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.container .post-item').get();
|
||||
|
||||
const ProcessFeed = (data) => {
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
// 提取内容
|
||||
return $('.container .post-content').html();
|
||||
return {
|
||||
desc: $('.container .post-content').html(),
|
||||
publish_time: $('.post-meta > time').attr('datetime'),
|
||||
};
|
||||
};
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
const $a = $('.article-title > a');
|
||||
const link = baseUrl + $a.attr('href');
|
||||
// const publish_time = $('.date-label').text();
|
||||
|
||||
const cache = await ctx.cache.get(link);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
@@ -38,14 +37,15 @@ module.exports = async (ctx) => {
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
|
||||
const description = ProcessFeed(response.data);
|
||||
const feed = ProcessFeed(response.data);
|
||||
const description = feed.desc;
|
||||
const pubDate = feed.publish_time;
|
||||
|
||||
const single = {
|
||||
title: $a.text(),
|
||||
description,
|
||||
link: link,
|
||||
// pubDate: publish_time,
|
||||
pubDate: pubDate,
|
||||
};
|
||||
ctx.cache.set(link, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
|
||||
Reference in New Issue
Block a user