feat(route): chinamoney (#14437)

This commit is contained in:
Tony
2024-02-09 22:44:50 +08:00
committed by GitHub
parent ec40c6baa7
commit 92e609ef5a
6 changed files with 173 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
const channels = {
2834: {
title: '最新 - 外汇市场公告 - 市场公告',
urlPath: '/chinese/scgg-whscgg/',
},
2835: {
title: '市场公告通知 - 外汇市场公告 - 市场公告',
urlPath: '/chinese/scgg-whscgg/',
},
2836: {
title: '中心会员公告 - 外汇市场公告 - 市场公告',
urlPath: '/chinese/scgg-whscgg/',
},
2837: {
title: '会员信息公告 - 外汇市场公告 - 市场公告',
urlPath: '/chinese/scgg-whscgg/',
},
//
'2839,2840,2841': {
title: '最新 - 本币市场公告 - 市场公告',
urlPath: '/chinese/scggbbscgg/',
},
2839: {
title: '市场公告通知 - 本币市场公告 - 市场公告',
urlPath: '/chinese/scggbbscgg/',
},
2840: {
title: '中心成员公告 - 本币市场公告 - 市场公告',
urlPath: '/chinese/scggbbscgg/',
},
2841: {
title: '成员信息公告 - 本币市场公告 - 市场公告',
urlPath: '/chinese/scggbbscgg/',
},
//
'2845,2846': {
title: '最新 - 央行业务公告 - 市场公告',
urlPath: '/chinese/scggyhywgg/',
},
2845: {
title: '公开市场操作 - 央行业务公告 - 市场公告',
urlPath: '/chinese/scggyhywgg/',
},
2846: {
title: '中央国库现金管理 - 央行业务公告 - 市场公告',
urlPath: '/chinese/scggyhywgg/',
},
//
3686: {
title: 'LPR市场公告 - 贷款市场报价利率 - 本币市场',
urlPath: '/chinese/bklpr/',
},
};
module.exports = {
channels,
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/:channelId?': ['TonyRL'],
};
+61
View File
@@ -0,0 +1,61 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const { channels } = require('./channels');
module.exports = async (ctx) => {
const { channelId = 2834 } = ctx.params;
const baseUrl = 'https://www.chinamoney.com.cn';
const { data: contents } = await got.post(`${baseUrl}/ags/ms/cm-s-notice-query/contents`, {
form: {
pageNo: 1,
pageSize: 15,
channelId,
},
});
const list = contents.records.map((item) => ({
title: item.title,
link: `${baseUrl}${item.draftPath}`,
pubDate: timezone(parseDate(item.releaseDate, 'YYYY-MM-DD'), +8),
contentId: item.contentId,
}));
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: response } = await got(item.link);
const $ = cheerio.load(response);
const article = $('.article-a-body');
article.find('*').removeAttr('style');
article.find('font').each((_, ele) => {
$(ele).replaceWith($(ele).html());
});
article.find('span').each((_, ele) => {
$(ele).replaceWith($(ele).html());
});
article.find('.article-a-attach-body a').each((i, ele) => {
ele = $(ele);
if (ele.attr('onclick')?.startsWith("location.href=encodeURI($('#fileDownUrl').val()+'fileDownLoad.do")) {
ele.attr('href', `${baseUrl}/dqs/cm-s-notice-query/fileDownLoad.do?mode=open&contentId=${item.contentId}&priority=${i}`);
ele.removeAttr('onclick');
}
});
item.description = article.html();
item.pubDate = timezone(parseDate($('.AC-l span').text().trim(), 'YYYY-MM-DD HH:mm'), +8);
return item;
})
)
);
ctx.state.data = {
title: `${channels[channelId] ? channels[channelId].title + ' - ' : ''}中国货币网`,
link: `${baseUrl}${channels[channelId]?.urlPath ?? ''}`,
item: items,
};
};
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
'chinamoney.com.cn': {
_name: '中国货币网',
'.': [
{
title: '公告',
docs: 'https://docs.rsshub.app/routes/finance#zhong-guo-huo-bi-wang',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/:channelId?', require('./notice'));
};
+38
View File
@@ -833,6 +833,44 @@ TokenInsight also provides official RSS, you can take a look at [https://api.tok
| company | 公司 |
</Route>
## 中国货币网 {#zhong-guo-huo-bi-wang}
### 公告 {#zhong-guo-huo-bi-wang-gong-gao}
<Route author="TonyRL" example="/chinamoney" path="/chinamoney/:channelId?" paramsDesc={['分类,见下表,默认为 `2834`']}>
<details>
<summary>市场公告</summary>
外汇市场公告
| 最新 | 市场公告通知 | 中心会员公告 | 会员信息公告 |
| ---- | ------------ | ------------ | ------------ |
| 2834 | 2835 | 2836 | 2837 |
本币市场公告
| 最新 | 市场公告通知 | 中心会员公告 | 会员信息公告 |
| -------------- | ------------ | ------------ | ------------ |
| 2839,2840,2841 | 2839 | 2840 | 2841 |
央行业务公告
| 最新 | 公开市场操作 | 中央国库现金管理 |
| --------- | ------------ | ---------------- |
| 2845,2846 | 2845 | 2846 |
</details>
<details>
<summary>本币市场</summary>
贷款市场报价利率
| LPR 市场公告 |
| ------------ |
| 3686 |
</details>
</Route>
## 中国期货市场监控中心 {#zhong-guo-qi-huo-shi-chang-jian-kong-zhong-xin}
### 栏目 {#zhong-guo-qi-huo-shi-chang-jian-kong-zhong-xin-lan-mu}