feat: add 财联社电报分类 (#6882)
This commit is contained in:
parent
20ddf80596
commit
26d28b2d43
|
|
@ -30,11 +30,17 @@ pageClass: routes
|
|||
|
||||
### 电报
|
||||
|
||||
<Route author="nczitzk" example="/cls/telegraph" path="/cls/telegraph"/>
|
||||
<Route author="nczitzk" example="/cls/telegraph" path="/cls/telegraph/:category?" :paramsDesc="['分类,见下表']">
|
||||
|
||||
| 看盘 | 公告 | 解读 | 加红 | 推送 | 提醒 | 基金 |
|
||||
| ----- | ------------ | ------- | ---- | ----- | ------ | ---- |
|
||||
| watch | announcement | explain | red | jpush | remind | fund |
|
||||
|
||||
</Route>
|
||||
|
||||
### 深度
|
||||
|
||||
<Route author="nczitzk" example="/cls/depth/1000" path="/cls/depth/:caty" :paramsDesc="['分类代码,可在首页导航栏的目标网址 URL 中找到']">
|
||||
<Route author="nczitzk" example="/cls/depth/1000" path="/cls/depth/:category?" :paramsDesc="['分类代码,可在首页导航栏的目标网址 URL 中找到']">
|
||||
|
||||
| 要闻 | 股市 | 环球 | 公司 | 地产 | 券商 | 金融 | 汽车 | 科创版 |
|
||||
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ------ |
|
||||
|
|
|
|||
|
|
@ -3021,9 +3021,8 @@ router.get('/gov/caict/caictgd', require('./routes/gov/caict/caictgd'));
|
|||
router.get('/cs/news/:caty', require('./routes/cs/news'));
|
||||
|
||||
// 财联社
|
||||
router.get('/cls/telegraph', require('./routes/cls/telegraph'));
|
||||
router.get('/cls/depth', require('./routes/cls/depth'));
|
||||
router.get('/cls/depth/:caty', require('./routes/cls/depth'));
|
||||
router.get('/cls/depth/:category?', require('./routes/cls/depth'));
|
||||
router.get('/cls/telegraph/:category?', require('./routes/cls/telegraph'));
|
||||
|
||||
// hentai-cosplays
|
||||
router.get('/hentai-cosplays/:type?/:name?', require('./routes/hentai-cosplays/hentai-cosplays'));
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ const config = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.params.caty = ctx.params.caty || '1000';
|
||||
const title = config[ctx.params.caty];
|
||||
ctx.params.category = ctx.params.category || '1000';
|
||||
const title = config[ctx.params.category];
|
||||
if (!title) {
|
||||
throw Error('Bad category. See <a href="https://docs.rsshub.app/finance.html#cai-lian-she-shen-du">docs</a>');
|
||||
}
|
||||
|
||||
const link = `https://www.cls.cn/v3/depth/home/assembled/${ctx.params.caty}?app=CailianpressWeb&os=web&sv=7.2.2&sign=6ac194f4b3b39d45631708474e058b73`;
|
||||
const link = `https://www.cls.cn/v3/depth/home/assembled/${ctx.params.category}?app=CailianpressWeb&os=web&sv=7.2.2&sign=6ac194f4b3b39d45631708474e058b73`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
const titles = {
|
||||
watch: '看盘',
|
||||
announcement: '公告',
|
||||
explain: '解读',
|
||||
red: '加红',
|
||||
jpush: '推送',
|
||||
remind: '提醒',
|
||||
fund: '基金',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `https://www.cls.cn/nodeapi/updateTelegraphList?rn=20`;
|
||||
const category = ctx.params.category || '';
|
||||
|
||||
const link = `https://www.cls.cn/nodeapi/updateTelegraphList?app=CailianpressWeb&category=${category}&hasFirstVipArticle=1&rn=30`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
|
|
@ -9,12 +21,13 @@ module.exports = async (ctx) => {
|
|||
|
||||
const list = response.data.data.roll_data.map((item) => ({
|
||||
title: item.title || item.content,
|
||||
link: item.shareurl,
|
||||
description: item.content,
|
||||
pubDate: new Date(item.ctime * 1000).toUTCString(),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `财联社 - 电报`,
|
||||
title: `财联社 - 电报${category === '' ? '' : ` - ${titles[category]}`}`,
|
||||
link: 'https://www.cls.cn/telegraph',
|
||||
item: list,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue