mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: 证监会要闻、发审委公告 (#2488)
This commit is contained in:
@@ -1439,6 +1439,10 @@ router.get('/8btc/:authorid', require('./routes/8btc/author'));
|
||||
// VueVlog
|
||||
router.get('/vuevideo/:userid', require('./routes/vuevideo/user'));
|
||||
|
||||
// 证监会
|
||||
router.get('/csrc/news', require('./routes/csrc/news'));
|
||||
router.get('/csrc/fashenwei', require('./routes/csrc/fashenwei'));
|
||||
|
||||
// LWN.net Alerts
|
||||
router.get('/lwn/alerts/:distributor', require('./routes/lwn/alerts'));
|
||||
|
||||
|
||||
45
lib/routes/csrc/fashenwei.js
Normal file
45
lib/routes/csrc/fashenwei.js
Normal file
@@ -0,0 +1,45 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://www.csrc.gov.cn/pub/zjhpublic/3300/3621/index_7401.htm';
|
||||
const ori_url = 'http://www.csrc.gov.cn/pub/zjhpublic/';
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('.row').get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
const time = $('li.fbrq').text();
|
||||
const title = $('li.mc > div').text();
|
||||
const sub_url = $('li.mc > div')
|
||||
.find('a')
|
||||
.attr('href')
|
||||
.slice(6);
|
||||
const itemUrl = ori_url + sub_url;
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const responses = await got.get(itemUrl);
|
||||
const $d = cheerio.load(responses.data);
|
||||
|
||||
const single = {
|
||||
title,
|
||||
pubDate: new Date(time).toUTCString(),
|
||||
link: itemUrl,
|
||||
guid: itemUrl,
|
||||
description: $d('#ContentRegion .Custom_UnionStyle').html(),
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
43
lib/routes/csrc/news.js
Normal file
43
lib/routes/csrc/news.js
Normal file
@@ -0,0 +1,43 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://www.csrc.gov.cn/pub/newsite/zjhxwfb/xwdd/';
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('.fl_list li').get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
const time = $('span').text();
|
||||
const title = $('a').text();
|
||||
const sub_url = $('a')
|
||||
.attr('href')
|
||||
.slice(2);
|
||||
const itemUrl = url + sub_url;
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const responses = await got.get(itemUrl);
|
||||
const $d = cheerio.load(responses.data);
|
||||
|
||||
const single = {
|
||||
title,
|
||||
pubDate: new Date(time).toUTCString(),
|
||||
link: itemUrl,
|
||||
guid: itemUrl,
|
||||
description: $d('.content .Custom_UnionStyle').html(),
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user