feat(route): add mof (bond management) 中华人民共和国财政部-专题-政府债券管理 (#14094)
* feat(route): add mof (bond management) * fix(router): re-order router config and add radar for mof * feat(router): radar param in route doc * fix(radar): add index source for mof * feat(radar): more source path for mof * Update website/docs/routes/government.mdx ---------
This commit is contained in:
parent
7a8c1bc18f
commit
fcbb3f402c
|
|
@ -35,6 +35,7 @@ module.exports = {
|
|||
'/moa/:suburl': ['Origami404'],
|
||||
'/moe/:type': ['Crawler995'],
|
||||
'/moe/s78/:column': ['TonyRL'],
|
||||
'/mof/bond/:category?': ['la3rence'],
|
||||
'/mofcom/article/:suffix+': ['LogicJake'],
|
||||
'/moj/aac/news/:type?': ['TonyRL'],
|
||||
'/mot/:category?': ['nczitzk'],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const domain = 'gks.mof.gov.cn';
|
||||
const theme = 'guozaiguanli';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = 'gzfxgzdt' } = ctx.params;
|
||||
const currentUrl = `https://${domain}/ztztz/${theme}/${category}/`;
|
||||
const { data: response } = await got(currentUrl);
|
||||
const $ = cheerio.load(response);
|
||||
const title = $('title').text();
|
||||
const author = $('div.zzName').text();
|
||||
const siteName = $('meta[name="SiteName"]').prop('content');
|
||||
const description = $('meta[name="ColumnDescription"]').prop('content');
|
||||
const indexes = $('ul.liBox li')
|
||||
.toArray()
|
||||
.map((li) => {
|
||||
const a = $(li).find('a');
|
||||
const pubDate = $(li).find('span').text();
|
||||
const href = a.prop('href');
|
||||
const link = href.startsWith('http') ? href : new URL(href, currentUrl).href;
|
||||
return {
|
||||
title: a.prop('title'),
|
||||
link,
|
||||
pubDate: timezone(parseDate(pubDate), +8),
|
||||
};
|
||||
});
|
||||
|
||||
const items = await Promise.all(
|
||||
indexes.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: detailResponse } = await got(item.link);
|
||||
const content = cheerio.load(detailResponse);
|
||||
item.description = content('div.my_doccontent').html();
|
||||
item.author = author;
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
item: items,
|
||||
title,
|
||||
link: currentUrl,
|
||||
description: `${description} - ${siteName}`,
|
||||
author,
|
||||
};
|
||||
};
|
||||
|
|
@ -1053,6 +1053,20 @@ module.exports = {
|
|||
},
|
||||
],
|
||||
},
|
||||
'mof.gov.cn': {
|
||||
_name: '中华人民共和国财政部',
|
||||
gks: [
|
||||
{
|
||||
title: '专题: 政府债券管理',
|
||||
docs: 'https://docs.rsshub.app/routes/government#zhong-hua-ren-min-gong-he-guo-cai-zheng-bu',
|
||||
source: ['/ztztz/guozaiguanli/:category', '/ztztz/guozaiguanli/:category/*', '/ztztz/guozaiguanli/'],
|
||||
target: (params) => {
|
||||
const category = params.category;
|
||||
return `/gov/mof/bond/${category ? category : ''}`;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
'mofcom.gov.cn': {
|
||||
_name: '中华人民共和国商务部',
|
||||
'.': [
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ module.exports = function (router) {
|
|||
router.get('/moa/:suburl(.*)', require('./moa/moa'));
|
||||
router.get('/moe/:type', require('./moe/moe'));
|
||||
router.get('/moe/s78/:column', require('./moe/s78'));
|
||||
router.get('/mof/bond/:category?', require('./mof/bond'));
|
||||
router.get('/mofcom/article/:suffix+', require('./mofcom/article'));
|
||||
router.get('/moj/aac/news/:type?', require('./moj/aac/news'));
|
||||
router.get('/ndrc/fggz/:category*', require('./ndrc/fggz'));
|
||||
|
|
|
|||
|
|
@ -1654,6 +1654,18 @@
|
|||
|
||||
<Route author="HenryQW" example="/embassy/us/chicago" path="/embassy/:country/:city" paramsDesc={['国家短代码, 见支持国家列表', '城市, 对应国家列表下的`领事馆城市列表`']} />
|
||||
|
||||
## 中华人民共和国财政部 {#zhong-hua-ren-min-gong-he-guo-cai-zheng-bu}
|
||||
|
||||
### 专题 {#zhong-hua-ren-min-gong-he-guo-cai-zheng-bu-zhuan-ti}
|
||||
|
||||
<Route author="la3rence" example="/gov/mof/bond" path="/gov/mof/bond/:category?" paramsDesc={['专题,见下表,默认为国债管理工作动态']} radar="1">
|
||||
#### 政府债券管理
|
||||
|
||||
| 国债管理工作动态 | 记账式国债 (含特别国债) 发行 | 储蓄国债发行 | 地方政府债券管理 |
|
||||
| ---------------- | ---------------------------- | ------------ | --------------------- |
|
||||
| gzfxgzdt | gzfxzjs | gzfxdzs | difangzhengfuzhaiquan |
|
||||
</Route>
|
||||
|
||||
## 中华人民共和国国家发展和改革委员会 {#zhong-hua-ren-min-gong-he-guo-guo-jia-fa-zhan-he-gai-ge-wei-yuan-hui}
|
||||
|
||||
### 新闻动态 {#zhong-hua-ren-min-gong-he-guo-guo-jia-fa-zhan-he-gai-ge-wei-yuan-hui-xin-wen-dong-tai}
|
||||
|
|
|
|||
Loading…
Reference in New Issue