diff --git a/docs/other.md b/docs/other.md index fb8fcf621f..52f94dd981 100644 --- a/docs/other.md +++ b/docs/other.md @@ -681,6 +681,10 @@ type 为 all 时,category 参数不支持 cost 和 free +### 公司公告-A 股港股 + + + ### 基金公告 diff --git a/lib/router.js b/lib/router.js index 894943b33f..4e92d3c36a 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1506,6 +1506,7 @@ router.get('/docschina/jsweekly', require('./routes/docschina/jsweekly')); router.get('/im2maker/:channel?', require('./routes/im2maker/index')); // 巨潮资讯 +router.get('/cninfo/announcement/:code?/:category?', require('./routes/cninfo/announcement')); router.get('/cninfo/stock_announcement/:code', require('./routes/cninfo/stock_announcement')); router.get('/cninfo/fund_announcement/:code?/:searchkey?', require('./routes/cninfo/fund_announcement')); diff --git a/lib/routes/cninfo/announcement.js b/lib/routes/cninfo/announcement.js new file mode 100644 index 0000000000..dcbaae6238 --- /dev/null +++ b/lib/routes/cninfo/announcement.js @@ -0,0 +1,51 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + let code = ctx.params.code; + const category = ctx.params.category || ''; + + if (code === 'all') { + code = ''; + } + + const url = `http://www.cninfo.com.cn/new/commonUrl?url=disclosure/list/notice-fund`; + const apiUrl = `http://www.cninfo.com.cn/new/hisAnnouncement/query?pageNum=1&pageSize=50&tabName=fulltext&column=&stock=${code}&searchkey=&secid=&plate=&category=category_${category}_szsh&trade=`; + + const response = await got.post(apiUrl, { + headers: { + Referer: url, + }, + }); + const announcements = response.data.announcements; + + let announcementsList = []; + for (let i = 0; i < announcements.length; i++) { + announcementsList = announcementsList.concat(announcements[i]); + } + + let name = ''; + const out = announcementsList.map((item) => { + const date = item.announcementTime; + const link = `http://static.cninfo.com.cn/${item.adjunctUrl}`; + name = item.secName; + const title = name + ': ' + item.announcementTitle; + + const single = { + title, + link, + pubDate: new Date(date).toUTCString(), + }; + + return single; + }); + + if (code === '') { + name = '最新'; + } + + ctx.state.data = { + title: `${name}${category}-公告-巨潮资讯`, + link: url, + item: out, + }; +}; diff --git a/lib/routes/xueqiu/hots.js b/lib/routes/xueqiu/hots.js index a392bd6227..75a63190a2 100644 --- a/lib/routes/xueqiu/hots.js +++ b/lib/routes/xueqiu/hots.js @@ -32,7 +32,7 @@ module.exports = async (ctx) => { item: data.map((item) => { const description = item.text; return { - title: item.title ? item.title : description, + title: item.title ? item.title : description.replace(/<[^>]+>/g, ''), description: item.text, pubDate: new Date(item.created_at).toUTCString(), link: `https://xueqiu.com${item.target}`, diff --git a/lib/routes/xueqiu/stock_info.js b/lib/routes/xueqiu/stock_info.js index 17a336bda4..0e411404f7 100644 --- a/lib/routes/xueqiu/stock_info.js +++ b/lib/routes/xueqiu/stock_info.js @@ -56,7 +56,7 @@ module.exports = async (ctx) => { link: `https://xueqiu.com/S/${id}`, description: `${stock_name} 的${source}`, item: data.map((item) => ({ - title: item.title !== '' ? item.title : item.description.replace(/<[^>]+>/g, '').slice(0, 30), + title: item.title !== '' ? item.title : item.description.replace(/<[^>]+>/g, ''), description: item.description, pubDate: new Date(item.created_at).toUTCString(), link: `https://xueqiu.com${item.target}`, diff --git a/lib/routes/xueqiu/user.js b/lib/routes/xueqiu/user.js index 4b5c15dc34..8764f727e2 100644 --- a/lib/routes/xueqiu/user.js +++ b/lib/routes/xueqiu/user.js @@ -41,7 +41,7 @@ module.exports = async (ctx) => { item: data.map((item) => { const description = item.description + (item.retweeted_status ? `
${item.retweeted_status.user.screen_name}: ${item.retweeted_status.description}
` : ''); return { - title: item.title ? item.title : description, + title: item.title ? item.title : description.replace(/<[^>]+>/g, ''), description: description, pubDate: new Date(item.created_at).toUTCString(), link: `https://xueqiu.com${item.target}`,