feat(route): add 深潮TechFlow (#9965)

* feat(route): add 深潮TechFlow

* fix: add category
This commit is contained in:
Ethan Shen
2022-06-16 20:06:47 +08:00
committed by GitHub
parent 71a16f5121
commit 0f3a0b76d4
6 changed files with 108 additions and 0 deletions

View File

@@ -3108,6 +3108,21 @@ column 为 third 时可选的 category:
<Route author="Jeason0228" example="/sspai/tag/apple" path="/sspai/tag/:keyword" :paramsDesc="['关键词']" radar="1"/>
## 深潮 TechFlow
### 分类
<Route author="nczitzk" example="/techflow520" path="/techflow520/:category?" :paramsDesc="['分类,见下表,默认为头条']">
| 头条 | 元宇宙 | 项目 | DeFi | 矿业 | 隐私计算 | 碳中和 | 活动 | NFT | 产业 |
| -- | --- | -- | ---- | -- | ---- | --- | -- | --- | -- |
</Route>
### 快讯
<Route author="nczitzk" example="/techflow520/newsflash" path="/techflow520/newsflash"/>
## 深焦
### 分类

View File

@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const category = ctx.params.category ?? '头条';
const rootUrl = 'https://www.techflow520.com';
const apiUrl = `${rootUrl}/index/index/tab_centet`;
const response = await got({
method: 'post',
url: apiUrl,
form: {
offect: 0,
typename: category,
pageval: 50,
},
});
const items = response.data.map((item) => ({
title: item.title,
link: `${rootUrl}/news/${item.id}`,
description: item.content,
pubDate: parseDate(item.time),
category: [item.keywords],
author: item.source,
}));
ctx.state.data = {
title: `深潮TechFlow - ${category}`,
link: rootUrl,
item: items,
};
};

View File

@@ -0,0 +1,4 @@
module.exports = {
'/newsflash': ['nczitzk'],
'/:category?': ['nczitzk'],
};

View File

@@ -0,0 +1,32 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const rootUrl = 'https://www.techflow520.com';
const currentUrl = `${rootUrl}/newflash`;
const apiUrl = `${rootUrl}/index/kuaixun/load_kuaixun`;
const response = await got({
method: 'post',
url: apiUrl,
form: {
offect: 0,
pageval: 50,
},
});
const items = response.data.map((item) => ({
title: item.title,
link: `${rootUrl}/news/${item.id}`,
description: item.content,
pubDate: parseDate(item.time),
category: [item.keywords],
author: item.source,
}));
ctx.state.data = {
title: '深潮TechFlow - 快讯',
link: currentUrl,
item: items,
};
};

View File

@@ -0,0 +1,19 @@
module.exports = {
'techflow520.com': {
_name: '深潮TechFlow',
'.': [
{
title: '分类',
docs: 'https://docs.rsshub.app/new-media.html#shen-chao-techflow-fen-lei',
source: ['/'],
target: '/techflow520/:category?',
},
{
title: '快讯',
docs: 'https://docs.rsshub.app/new-media.html#shen-chao-techflow-kuai-xun',
source: ['/newsflash'],
target: '/techflow520/newsflash',
},
],
},
};

View File

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