mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
feat: add 中央纪委国家监委审查调查 (#2614)
* feat: add 中央纪委国家监委审查调查 * no cache time Co-authored-by: DIYgod <diy.d.god@gmail.com>
This commit is contained in:
@@ -198,6 +198,12 @@ pageClass: routes
|
||||
|
||||
<Route author="SunShinenny" example="/gov/veterans/index" path="/gov/veterans/index"/>
|
||||
|
||||
## 中央纪委国家监委
|
||||
|
||||
### 审查调查
|
||||
|
||||
<Route author="LogicJake" example="/ccdi/scdc" path="/ccdi/scdc"/>
|
||||
|
||||
## 中华人民共和国外交部
|
||||
|
||||
### 发言人表态
|
||||
|
||||
@@ -1495,6 +1495,9 @@ router.get('/aptonic/action', require('./routes/aptonic/action'));
|
||||
// 印记中文周刊
|
||||
router.get('/docschina/jsweekly', require('./routes/docschina/jsweekly'));
|
||||
|
||||
// 中央纪委国家监委网站
|
||||
router.get('/ccdi/scdc', require('./routes/ccdi/scdc'));
|
||||
|
||||
// 香水时代
|
||||
router.get('/nosetime/:id/:type/:sort?', require('./routes/nosetime/comment'));
|
||||
router.get('/nosetime/home', require('./routes/nosetime/home'));
|
||||
|
||||
47
lib/routes/ccdi/scdc.js
Normal file
47
lib/routes/ccdi/scdc.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const { resolve } = require('url');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://www.ccdi.gov.cn/scdc/';
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const list = $('ul.list_news_dl.fixed li');
|
||||
const out = await Promise.all(
|
||||
list
|
||||
.map(async (index, elem) => {
|
||||
elem = $(elem);
|
||||
const title = elem.find('a').text();
|
||||
const link = resolve(url, elem.find('a').attr('href'));
|
||||
const pubDate = new Date(elem.find('span').text()).toUTCString();
|
||||
|
||||
const item = {
|
||||
title,
|
||||
pubDate,
|
||||
link,
|
||||
};
|
||||
|
||||
const key = link;
|
||||
const value = await ctx.cache.get(key);
|
||||
if (value) {
|
||||
item.description = value;
|
||||
} else {
|
||||
const response = await got.get(item.link);
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
item.description = $('div.TRS_Editor').html();
|
||||
ctx.cache.set(key, item.description);
|
||||
}
|
||||
|
||||
return Promise.resolve(item);
|
||||
})
|
||||
.get()
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中央纪委国家监委-审查调查',
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user