mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add 国家能源局发展规划司 (#14039)
This commit is contained in:
@@ -36,6 +36,7 @@ module.exports = {
|
||||
'/mofcom/article/:suffix+': ['LogicJake'],
|
||||
'/moj/aac/news/:type?': ['TonyRL'],
|
||||
'/mot/:category?': ['nczitzk'],
|
||||
'/nea/sjzz/ghs': ['nczitzk'],
|
||||
'/news/:uid': ['EsuRt'],
|
||||
'/nifdc/:path?': ['nczitzk'],
|
||||
'/nmpa/:path+': ['TonyRL'],
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 35;
|
||||
|
||||
const rootUrl = 'https://www.nea.gov.cn';
|
||||
const currentUrl = new URL('sjzz/ghs/', rootUrl).href;
|
||||
|
||||
const { data: response } = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
let items = $('div.right_box ul li')
|
||||
.slice(0, limit)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const a = item.find('a');
|
||||
|
||||
return {
|
||||
title: a.text(),
|
||||
link: a.prop('href'),
|
||||
pubDate: parseDate(item.find('span.date-tex').text()),
|
||||
};
|
||||
});
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: detailResponse } = await got(item.link);
|
||||
|
||||
const content = cheerio.load(detailResponse);
|
||||
|
||||
item.title = content('meta[name="ArticleTitle"]').prop('content');
|
||||
item.description = content('td.detail').html() || content('div.article-content td').html();
|
||||
item.author = content('meta[name="ContentSource"]').prop('content');
|
||||
item.category = content('meta[name="keywords"]').prop('content').split(/,/);
|
||||
item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').prop('content')), +8);
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
item: items,
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
description: $('meta[name="ColumnDescription"]').prop('content'),
|
||||
language: 'zh',
|
||||
subtitle: $('meta[name="ColumnType"]').prop('content'),
|
||||
author: $('meta[name="ColumnKeywords"]').prop('content'),
|
||||
};
|
||||
};
|
||||
@@ -1048,6 +1048,17 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'nea.gov.cn': {
|
||||
_name: '国家能源局',
|
||||
'.': [
|
||||
{
|
||||
title: '发展规划司',
|
||||
docs: 'https://docs.rsshub.app/routes/government#guo-jia-neng-yuan-ju-fa-zhan-gui-hua-si',
|
||||
source: ['/sjzz/ghs/'],
|
||||
target: '/gov/nea/sjzz/ghs',
|
||||
},
|
||||
],
|
||||
},
|
||||
'nifdc.gov.cn': {
|
||||
_name: '国家药品监督管理局医疗器械标准管理中心',
|
||||
'.': [
|
||||
|
||||
@@ -29,6 +29,7 @@ module.exports = function (router) {
|
||||
router.get('/moe/s78/:column', require('./moe/s78'));
|
||||
router.get('/mofcom/article/:suffix+', require('./mofcom/article'));
|
||||
router.get('/moj/aac/news/:type?', require('./moj/aac/news'));
|
||||
router.get('/nea/sjzz/ghs', require('./nea/ghs'));
|
||||
router.get('/news/:uid', require('./news'));
|
||||
router.get('/nifdc/:path*', require('./nifdc'));
|
||||
router.get(/\/nmpa\/([\w][\w/]+)?/, require('./nmpa/generic'));
|
||||
|
||||
@@ -423,6 +423,12 @@
|
||||
| 其他 | qt |
|
||||
</Route>
|
||||
|
||||
## 国家能源局 {#guo-jia-neng-yuan-ju}
|
||||
|
||||
### 发展规划司 {#guo-jia-neng-yuan-ju-fa-zhan-gui-hua-si}
|
||||
|
||||
<Route author="nczitzk" example="/gov/nea/sjzz/ghs" path="/gov/nea/sjzz/ghs" radar="1"/>
|
||||
|
||||
## 国家市场监督管理总局 {#guo-jia-shi-chang-jian-du-guan-li-zong-ju}
|
||||
|
||||
### 留言咨询 {#guo-jia-shi-chang-jian-du-guan-li-zong-ju-liu-yan-zi-xun}
|
||||
|
||||
Reference in New Issue
Block a user