feat(route): add 中华人民共和国应急管理部事故及灾害查处 (#13642)
* feat(route): add 中华人民共和国应急管理部事故及灾害查处 * fix: maintainer ---------
This commit is contained in:
@@ -20,7 +20,8 @@ module.exports = {
|
||||
'/fmprc/:category?': ['nicolaszf', 'nczitzk'],
|
||||
'/immiau/news': ['liu233w'],
|
||||
'/jinan/healthcommission/medical_exam_notice': ['tzjyxb'],
|
||||
'/mee/ywdt?': ['liuxsdev'],
|
||||
'/mee/ywdt/:category?': ['liuxsdev'],
|
||||
'/mem/gk/sgcc/:category?': ['nczitzk'],
|
||||
'/mfa/wjdt/:category?': ['nczitzk'],
|
||||
'/miit/wjfb/:ministry': ['Fatpandac'],
|
||||
'/miit/yjzj': ['Fatpandac'],
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = 'sggpdbqk' } = ctx.params;
|
||||
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30;
|
||||
|
||||
const rootUrl = 'https://www.mem.gov.cn';
|
||||
const currentUrl = new URL(`gk/sgcc/${category}`, rootUrl).href;
|
||||
|
||||
const { data: response } = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
let items = $('table.center_main02')
|
||||
.find('a[title]')
|
||||
.slice(0, limit)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const regExp = new RegExp(`\\/sgcc\\/${category}\\/\\.\\.\\.`);
|
||||
const link = new URL(`${category}/${item.prop('href').replace(/\.\//, '')}`, currentUrl).href.replace(regExp, '');
|
||||
|
||||
return {
|
||||
title: item.contents().first().text(),
|
||||
link,
|
||||
pubDate: parseDate(item.find('span').text()),
|
||||
enclosure_url: link,
|
||||
enclosure_type: `application/${link.split(/\./).pop()}`,
|
||||
};
|
||||
});
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
if (item.link.endsWith('html')) {
|
||||
const { data: detailResponse } = await got(item.link);
|
||||
|
||||
const content = cheerio.load(detailResponse);
|
||||
|
||||
item.description = content('#content').html();
|
||||
}
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
const icon = new URL($('link[rel="shortcut icon"]').prop('href'), rootUrl).href;
|
||||
|
||||
ctx.state.data = {
|
||||
item: items,
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
description: $('meta[name="ColumnDescription"]').prop('content'),
|
||||
language: 'zh',
|
||||
image: new URL($('#imag').prop('src'), rootUrl).href,
|
||||
icon,
|
||||
logo: icon,
|
||||
subtitle: $('meta[name="ColumnName"]').prop('content'),
|
||||
author: $('meta[name="SiteName"]').prop('content'),
|
||||
};
|
||||
};
|
||||
@@ -703,6 +703,17 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'mem.gov.cn': {
|
||||
_name: '应急管理部',
|
||||
www: [
|
||||
{
|
||||
title: '事故及灾害查处',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-ying-ji-guan-li-bu',
|
||||
source: ['/gk/sgcc/:category'],
|
||||
target: '/gov/mem/gk/sgcc/:category',
|
||||
},
|
||||
],
|
||||
},
|
||||
'mfa.gov.cn': {
|
||||
_name: '中华人民共和国外交部',
|
||||
www: [
|
||||
|
||||
@@ -13,6 +13,7 @@ module.exports = function (router) {
|
||||
router.get('/immiau/news', require('./immiau/news'));
|
||||
router.get('/jinan/healthcommission/medical_exam_notice', require('./jinan/healthcommission/medical_exam_notice'));
|
||||
router.get('/mee/ywdt/:category?', require('./mee/ywdt'));
|
||||
router.get('/mem/gk/sgcc/:category?', require('./mem/sgcc'));
|
||||
router.get('/mfa/wjdt/:category?', require('./mfa/wjdt'));
|
||||
router.get('/miit/wjfb/:ministry', require('./miit/wjfb'));
|
||||
router.get('/miit/yjzj', require('./miit/yjzj'));
|
||||
|
||||
@@ -1753,6 +1753,18 @@ Language
|
||||
|
||||
</Route>
|
||||
|
||||
## 中华人民共和国应急管理部 {#zhong-hua-ren-min-gong-he-guo-ying-ji-guan-li-bu}
|
||||
|
||||
### 事故及灾害查处 {#zhong-hua-ren-min-gong-he-guo-ying-ji-guan-li-bu-shi-gu-ji-zai-hai-cha-chu}
|
||||
|
||||
<Route author="nczitzk" example="/gov/mem/gk/sgcc/tbzdsgdcbg" path="/gov/mem/gk/sgcc/:category?" paramsDesc={['分类,见下表,默认为挂牌督办']} radar="1" rssbud="1">
|
||||
|
||||
| 挂牌督办 | 调查报告 |
|
||||
| -------- | ---------- |
|
||||
| sggpdbqk | tbzdsgdcbg |
|
||||
|
||||
</Route>
|
||||
|
||||
## 中华人民共和国住房和城乡建设部 {#zhong-hua-ren-min-gong-he-guo-zhu-fang-he-cheng-xiang-jian-she-bu}
|
||||
|
||||
### 政策发布 {#zhong-hua-ren-min-gong-he-guo-zhu-fang-he-cheng-xiang-jian-she-bu-zheng-ce-fa-bu}
|
||||
|
||||
Reference in New Issue
Block a user