diff --git a/docs/finance.md b/docs/finance.md index 6850b5acf..050c13a64 100644 --- a/docs/finance.md +++ b/docs/finance.md @@ -26,6 +26,16 @@ pageClass: routes | -------- | -------- | -------- | -------- | -------- | -------- | -------- | ---------- | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | +## 财联社 + +### 电报 + + + +### 深度 + + + ## 淘股吧股票论坛 ### 论坛总版 diff --git a/lib/router.js b/lib/router.js index f235218e1..fc0a165ca 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2814,6 +2814,10 @@ router.get('/gov/caict/bps', require('./routes/gov/caict/bps')); router.get('/gov/caict/qwsj', require('./routes/gov/caict/qwsj')); router.get('/gov/caict/caictgd', require('./routes/gov/caict/caictgd')); +// 财联社 +router.get('/cls/telegraph', require('./routes/cls/telegraph')); +router.get('/cls/depth', require('./routes/cls/depth')); + // hentai-cosplays router.get('/hentai-cosplays/:type?/:name?', require('./routes/hentai-cosplays/hentai-cosplays')); router.get('/porn-images-xxx/:type?/:name?', require('./routes/hentai-cosplays/porn-images-xxx')); diff --git a/lib/routes/cls/depth.js b/lib/routes/cls/depth.js new file mode 100644 index 000000000..af2412bee --- /dev/null +++ b/lib/routes/cls/depth.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const link = `https://www.cls.cn/depth`; + const response = await got({ + method: 'get', + url: link, + }); + + const data = JSON.parse(response.data.match(/"depth":(.*?),"reference":/)[1]); + + const list = data.dataList.map((item) => ({ + title: item.title, + link: `https://www.cls.cn/depth/${item.article_id}`, + pubDate: new Date(item.ctime * 1000).toUTCString(), + })); + + ctx.state.data = { + title: `财联社 - 深度`, + link: link, + item: await Promise.all( + list.map( + async (item) => + await ctx.cache.tryGet(item.link, async () => { + const contentResponse = await got({ method: 'get', url: item.link }); + const content = cheerio.load(contentResponse.data); + item.description = content('div.thisContent').html(); + return item; + }) + ) + ), + }; +}; diff --git a/lib/routes/cls/telegraph.js b/lib/routes/cls/telegraph.js new file mode 100644 index 000000000..078ed5819 --- /dev/null +++ b/lib/routes/cls/telegraph.js @@ -0,0 +1,21 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const link = `https://www.cls.cn/nodeapi/telegraphs?&rn=20`; + const response = await got({ + method: 'get', + url: link, + }); + + const list = response.data.data.roll_data.map((item) => ({ + title: item.title ? item.title : item.content, + description: item.content, + pubDate: new Date(item.ctime * 1000).toUTCString(), + })); + + ctx.state.data = { + title: `财联社 - 电报`, + link: 'https://www.cls.cn/telegraph', + item: list, + }; +};