mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: add 证监会消息 (#2664)
This commit is contained in:
@@ -77,6 +77,16 @@ pageClass: routes
|
|||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
## 中国证券监督管理委员会
|
||||||
|
|
||||||
|
### 发审委公告
|
||||||
|
|
||||||
|
<Route author="chinobing" example="/csrc/fashenwei" path="/csrc/fashenwei"/>
|
||||||
|
|
||||||
|
### 证监会消息
|
||||||
|
|
||||||
|
<Route author="chinobing LogicJake" example="/csrc/news/zjhxwfb-xwfbh" path="/csrc/news/:suffix?" :paramsDesc="['支持形如 http://www.csrc.gov.cn/pub/newsite/*/* 的网站,将 newsite 后面的两段网址后缀以"-"连接']" />
|
||||||
|
|
||||||
## 中国驻外使领馆
|
## 中国驻外使领馆
|
||||||
|
|
||||||
### 大使馆重要通知
|
### 大使馆重要通知
|
||||||
|
|||||||
@@ -1470,7 +1470,7 @@ router.get('/8btc/:authorid', require('./routes/8btc/author'));
|
|||||||
router.get('/vuevideo/:userid', require('./routes/vuevideo/user'));
|
router.get('/vuevideo/:userid', require('./routes/vuevideo/user'));
|
||||||
|
|
||||||
// 证监会
|
// 证监会
|
||||||
router.get('/csrc/news', require('./routes/csrc/news'));
|
router.get('/csrc/news/:suffix?', require('./routes/csrc/news'));
|
||||||
router.get('/csrc/fashenwei', require('./routes/csrc/fashenwei'));
|
router.get('/csrc/fashenwei', require('./routes/csrc/fashenwei'));
|
||||||
|
|
||||||
// LWN.net Alerts
|
// LWN.net Alerts
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
|
const { resolve } = require('url');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
const url = 'http://www.csrc.gov.cn/pub/newsite/zjhxwfb/xwdd/';
|
let suffix = ctx.params.suffix || 'zjhxwfb-xwdd';
|
||||||
|
suffix = suffix.replace('-', '/');
|
||||||
|
const url = resolve('http://www.csrc.gov.cn/pub/newsite/', suffix + '/');
|
||||||
const res = await got.get(url);
|
const res = await got.get(url);
|
||||||
const $ = cheerio.load(res.data);
|
const $ = cheerio.load(res.data);
|
||||||
|
const title = $('div.title .bt').text();
|
||||||
const list = $('.fl_list li').get();
|
const list = $('.fl_list li').get();
|
||||||
|
|
||||||
const out = await Promise.all(
|
const out = await Promise.all(
|
||||||
@@ -12,10 +16,8 @@ module.exports = async (ctx) => {
|
|||||||
const $ = cheerio.load(item);
|
const $ = cheerio.load(item);
|
||||||
const time = $('span').text();
|
const time = $('span').text();
|
||||||
const title = $('a').text();
|
const title = $('a').text();
|
||||||
const sub_url = $('a')
|
const sub_url = $('a').attr('href');
|
||||||
.attr('href')
|
const itemUrl = resolve(url, sub_url);
|
||||||
.slice(2);
|
|
||||||
const itemUrl = url + sub_url;
|
|
||||||
const cache = await ctx.cache.get(itemUrl);
|
const cache = await ctx.cache.get(itemUrl);
|
||||||
if (cache) {
|
if (cache) {
|
||||||
return Promise.resolve(JSON.parse(cache));
|
return Promise.resolve(JSON.parse(cache));
|
||||||
@@ -29,14 +31,14 @@ module.exports = async (ctx) => {
|
|||||||
pubDate: new Date(time).toUTCString(),
|
pubDate: new Date(time).toUTCString(),
|
||||||
link: itemUrl,
|
link: itemUrl,
|
||||||
guid: itemUrl,
|
guid: itemUrl,
|
||||||
description: $d('.content .Custom_UnionStyle').html(),
|
description: $d('.content .Custom_UnionStyle').html() || $d('.contentss').html() || $d('.Section0').html(),
|
||||||
};
|
};
|
||||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||||
return Promise.resolve(single);
|
return Promise.resolve(single);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: $('title').text(),
|
title: `中国证券监督管理委员会-${title}`,
|
||||||
link: url,
|
link: url,
|
||||||
item: out,
|
item: out,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user