feat(route): add AI财经社 (#10623)

* chore(deps): bump dayjs from 1.11.4 to 1.11.5 (#258)

Bumps [dayjs](https://github.com/iamkun/dayjs) from 1.11.4 to 1.11.5.
- [Release notes](https://github.com/iamkun/dayjs/releases)
- [Changelog](https://github.com/iamkun/dayjs/blob/v1.11.5/CHANGELOG.md)
- [Commits](https://github.com/iamkun/dayjs/compare/v1.11.4...v1.11.5)

---
updated-dependencies:
- dependency-name: dayjs
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump rand-user-agent from 1.0.76 to 1.0.77 (#259)

Bumps [rand-user-agent](https://github.com/WebScrapingAPI/rand-user-agent) from 1.0.76 to 1.0.77.
- [Release notes](https://github.com/WebScrapingAPI/rand-user-agent/releases)
- [Commits](https://github.com/WebScrapingAPI/rand-user-agent/commits)

---
updated-dependencies:
- dependency-name: rand-user-agent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump twitter-api-v2 from 1.12.3 to 1.12.5 (#261)

Bumps [twitter-api-v2](https://github.com/plhery/node-twitter-api-v2) from 1.12.3 to 1.12.5.
- [Release notes](https://github.com/plhery/node-twitter-api-v2/releases)
- [Changelog](https://github.com/PLhery/node-twitter-api-v2/blob/master/changelog.md)
- [Commits](https://github.com/plhery/node-twitter-api-v2/compare/1.12.3...1.12.5)

---
updated-dependencies:
- dependency-name: twitter-api-v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump puppeteer from 16.1.0 to 16.1.1 (#262)

Bumps [puppeteer](https://github.com/puppeteer/puppeteer) from 16.1.0 to 16.1.1.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
- [Changelog](https://github.com/puppeteer/puppeteer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/puppeteer/puppeteer/compare/v16.1.0...v16.1.1)

---
updated-dependencies:
- dependency-name: puppeteer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump rand-user-agent from 1.0.77 to 1.0.78 (#268)

Bumps [rand-user-agent](https://github.com/WebScrapingAPI/rand-user-agent) from 1.0.77 to 1.0.78.
- [Release notes](https://github.com/WebScrapingAPI/rand-user-agent/releases)
- [Commits](https://github.com/WebScrapingAPI/rand-user-agent/commits)

---
updated-dependencies:
- dependency-name: rand-user-agent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump ioredis from 5.2.2 to 5.2.3 (#271)

Bumps [ioredis](https://github.com/luin/ioredis) from 5.2.2 to 5.2.3.
- [Release notes](https://github.com/luin/ioredis/releases)
- [Changelog](https://github.com/luin/ioredis/blob/main/CHANGELOG.md)
- [Commits](https://github.com/luin/ioredis/compare/v5.2.2...v5.2.3)

---
updated-dependencies:
- dependency-name: ioredis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(route): add AI财经社

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Ethan Shen 2022-08-26 20:31:33 +08:00 committed by GitHub
parent 17fa8f5f67
commit 2dcf277ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 155 additions and 0 deletions

View File

@ -4,6 +4,44 @@ pageClass: routes
# 金融
## AI 财经社
### 最新文章
<Route author="nczitzk" example="/aicaijing/latest" path="/aicaijing/latest"/>
### 封面文章
<Route author="nczitzk" example="/aicaijing/cover" path="/aicaijing/cover"/>
### 推荐资讯
<Route author="nczitzk" example="/aicaijing/recommend" path="/aicaijing/recommend"/>
### 热点 & 深度
<Route author="nczitzk" example="/aicaijing/information/14" path="/aicaijing/information/:id?" :paramsDesc="['栏目 id可在对应栏目页 URL 中找到,默认为 14即热点最新']">
| 栏目 id | 栏目 |
| ----- | ------- |
| 14 | 热点 - 最新 |
| 5 | 热点 - 科技 |
| 9 | 热点 - 消费 |
| 7 | 热点 - 出行 |
| 13 | 热点 - 文娱 |
| 10 | 热点 - 教育 |
| 25 | 热点 - 地产 |
| 11 | 热点 - 更多 |
| 28 | 深度 - 出行 |
| 29 | 深度 - 科技 |
| 31 | 深度 - 消费 |
| 33 | 深度 - 教育 |
| 34 | 深度 - 更多 |
| 8 | 深度 - 地产 |
| 6 | 深度 - 文娱 |
</Route>
## BigQuant
### 专题报告

73
lib/v2/aicaijing/index.js Normal file
View File

@ -0,0 +1,73 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const category = ctx.params.category ?? 'latest';
const id = ctx.params.id ?? 14;
const titles = {
14: '热点 - 最新',
5: '热点 - 科技',
9: '热点 - 消费',
7: '热点 - 出行',
13: '热点 - 文娱',
10: '热点 - 教育',
25: '热点 - 地产',
11: '热点 - 更多',
28: '深度 - 出行',
29: '深度 - 科技',
31: '深度 - 消费',
33: '深度 - 教育',
34: '深度 - 更多',
8: '深度 - 地产',
6: '深度 - 文娱',
};
const categories = {
latest: {
url: '',
title: '最新文章',
},
recommend: {
url: '&isRecommend=true',
title: '推荐资讯',
},
cover: {
url: '&position=1',
title: '封面文章',
},
information: {
url: `&categoryId=${id}`,
title: titles[id],
},
};
const rootUrl = 'https://www.aicaijing.com.cn';
const apiRootUrl = 'https://api.aicaijing.com.cn';
const apiUrl = `${apiRootUrl}/article/detail/list?size=${ctx.query.limit ?? 50}&page=1${categories[category].url}`;
const response = await got({
method: 'get',
url: apiUrl,
});
const items = response.data.data.items.map((item) => ({
title: item.title,
link: `${rootUrl}/article/${item.articleId}`,
author: item.userInfo.nickname,
pubDate: parseDate(item.createTime),
category: [item.category.name].concat(item.tags.map((t) => t.name)),
description: art(path.join(__dirname, 'templates/description.art'), {
image: item.cover,
description: item.content,
}),
}));
ctx.state.data = {
title: `AI 财经社 - ${categories[category].title}`,
link: rootUrl,
item: items,
};
};

View File

@ -0,0 +1,6 @@
module.exports = {
'/cover': ['nczitzk'],
'/information/:id?': ['nczitzk'],
'/latest': ['nczitzk'],
'/recommend': ['nczitzk'],
};

31
lib/v2/aicaijing/radar.js Normal file
View File

@ -0,0 +1,31 @@
module.exports = {
'aicaijing.com': {
_name: 'AI 财经社',
www: [
{
title: '最新文章',
docs: 'https://docs.rsshub.app/finance.html#ai-cai-jing-she-zui-xin-wen-zhang',
source: ['/'],
target: '/aicaijing/latest',
},
{
title: '封面文章',
docs: 'https://docs.rsshub.app/finance.html#ai-cai-jing-she-feng-mian-wen-zhang',
source: ['/'],
target: '/aicaijing/cover',
},
{
title: '推荐资讯',
docs: 'https://docs.rsshub.app/finance.html#ai-cai-jing-she-tui-jian-zi-xun',
source: ['/'],
target: '/aicaijing/recommend',
},
{
title: '热点 & 深度',
docs: 'https://docs.rsshub.app/finance.html#ai-cai-jing-she-re-dian-shen-du',
source: ['/information/:id', '/'],
target: '/aicaijing/information/:id?',
},
],
},
};

View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/:category?/:id?', require('./'));
};

View File

@ -0,0 +1,4 @@
{{ if image }}
<img src="{{ image }}">
{{ /if }}
{{@ description }}