mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 21:47:57 +08:00
feat: add 巨潮资讯网-个股公告 (#2615)
* feat: add 巨潮资讯网-个股公告 * delete Promise.all Co-authored-by: DIYgod <diy.d.god@gmail.com>
This commit is contained in:
@@ -548,6 +548,12 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route author="LogicJake" example="/whalegogo/home" path="/whalegogo/home"/>
|
||||
|
||||
## 巨潮资讯
|
||||
|
||||
### 公司公告
|
||||
|
||||
<Route author="LogicJake" example="/cninfo/stock_announcement/000410" path="/cninfo/stock_announcement/:code" :paramsDesc="['股票代码']"/>
|
||||
|
||||
## 决胜网
|
||||
|
||||
### 最新资讯
|
||||
|
||||
@@ -1495,6 +1495,9 @@ router.get('/aptonic/action', require('./routes/aptonic/action'));
|
||||
// 印记中文周刊
|
||||
router.get('/docschina/jsweekly', require('./routes/docschina/jsweekly'));
|
||||
|
||||
// 巨潮资讯
|
||||
router.get('/cninfo/stock_announcement/:code', require('./routes/cninfo/stock_announcement'));
|
||||
|
||||
// 中央纪委国家监委网站
|
||||
router.get('/ccdi/scdc', require('./routes/ccdi/scdc'));
|
||||
|
||||
|
||||
42
lib/routes/cninfo/stock_announcement.js
Normal file
42
lib/routes/cninfo/stock_announcement.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const code = ctx.params.code;
|
||||
|
||||
const url = `http://www.cninfo.com.cn/new/disclosure/stock?plate=szse&stockCode=${code}`;
|
||||
const apiUrl = `http://www.cninfo.com.cn/new/singleDisclosure/fulltext?stock=${code}&pageSize=20&pageNum=1&tabname=latest&plate=szse&limit=`;
|
||||
|
||||
const response = await got.post(apiUrl, {
|
||||
headers: {
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
const classifiedList = response.data.classifiedAnnouncements;
|
||||
|
||||
let announcementsList = [];
|
||||
for (let i = 0; i < classifiedList.length; i++) {
|
||||
announcementsList = announcementsList.concat(classifiedList[i]);
|
||||
}
|
||||
announcementsList = announcementsList.slice(0, 10);
|
||||
|
||||
let name = '';
|
||||
const out = announcementsList.map((item) => {
|
||||
const title = item.announcementTitle;
|
||||
const date = item.announcementTime;
|
||||
const link = `http://www.cninfo.com.cn/new/disclosure/detail?plate=szse&stockCode=${code}&announcementId=${item.announcementId}`;
|
||||
name = item.secName;
|
||||
|
||||
const single = {
|
||||
title,
|
||||
link,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
};
|
||||
|
||||
return single;
|
||||
});
|
||||
ctx.state.data = {
|
||||
title: `${name}公司公告-巨潮资讯`,
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user