mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-28 23:19:27 +08:00
fix: zhengce-zuixin (#2382)
This commit is contained in:
@@ -14,14 +14,15 @@ module.exports = async (ctx) => {
|
||||
const $el = $list(el);
|
||||
const $a = $el.find('h4 a');
|
||||
const href = $a.attr('href');
|
||||
const key = `gov_zhengce: ${href}`;
|
||||
const link = href.startsWith('/zhengce') ? `http://www.gov.cn${href}` : href;
|
||||
const key = `gov_zhengce_zuixin: ${link}`;
|
||||
let description;
|
||||
const value = await ctx.cache.get(key);
|
||||
|
||||
if (value) {
|
||||
description = value;
|
||||
} else {
|
||||
const contentData = await got.get(href.startsWith('/zhengce') ? `http://www.gov.cn${href}` : href);
|
||||
const contentData = await got.get(link);
|
||||
const $content = cheerio.load(contentData.data);
|
||||
description = $content('#UCAP-CONTENT').html();
|
||||
ctx.cache.set(key, description);
|
||||
@@ -30,7 +31,8 @@ module.exports = async (ctx) => {
|
||||
return {
|
||||
title: $a.text(),
|
||||
description,
|
||||
link: $a.attr('href'),
|
||||
guid: href,
|
||||
link,
|
||||
pubDate: new Date($el.find('.date').text()).toUTCString(),
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user