fix(route): 深潮TechFlow (#10732)

This commit is contained in:
Ethan Shen 2022-09-07 20:30:51 +08:00 committed by GitHub
parent e15406fe81
commit 1daf3a3242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 81 additions and 88 deletions

View File

@ -3325,18 +3325,13 @@ column 为 third 时可选的 category:
## 深潮 TechFlow
### 分类
### 首页
<Route author="nczitzk" example="/techflow520" path="/techflow520/:category?" :paramsDesc="['分类,见下表,默认为头条']">
| 头条 | 元宇宙 | 项目 | DeFi | 矿业 | 隐私计算 | 碳中和 | 活动 | NFT | 产业 |
| -- | --- | -- | ---- | -- | ---- | --- | -- | --- | -- |
</Route>
<Route author="nczitzk" example="/techflowpost" path="/techflowpost" />
### 快讯
<Route author="nczitzk" example="/techflow520/newsflash" path="/techflow520/newsflash"/>
<Route author="nczitzk" example="/techflowpost/express" path="/techflowpost/express" />
## 深焦

View File

@ -1,34 +0,0 @@
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

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

View File

@ -1,32 +0,0 @@
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

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

View File

@ -0,0 +1,33 @@
const got = require('@/utils/got');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
const { unescapeAll } = require('markdown-it/lib/common/utils');
module.exports = async (ctx) => {
const rootUrl = 'https://www.techflowpost.com';
const apiRootUrl = 'https://data.techflowpost.com';
const currentUrl = `${rootUrl}/express`;
const apiUrl = `${apiRootUrl}/api/pc/express/all?pageIndex=0&pageSize=${ctx.query.limit ?? 50}`;
const response = await got({
method: 'post',
url: apiUrl,
json: {
createTime: [],
},
});
const items = response.data.content.map((item) => ({
title: item.title,
link: `${rootUrl}/express/${item.id}`,
category: item.tags?.split('') ?? [],
pubDate: timezone(parseDate(item.createTime), +8),
description: unescapeAll(item.content),
}));
ctx.state.data = {
title: '深潮TechFlow - 快讯',
link: currentUrl,
item: items,
};
};

View File

@ -0,0 +1,30 @@
const got = require('@/utils/got');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
const { unescapeAll } = require('markdown-it/lib/common/utils');
module.exports = async (ctx) => {
const rootUrl = 'https://www.techflowpost.com';
const apiRootUrl = 'https://data.techflowpost.com';
const apiUrl = `${apiRootUrl}/api/pc/home/more?pageIndex=0&pageSize=${ctx.query.limit ?? 50}`;
const response = await got({
method: 'get',
url: apiUrl,
});
const items = response.data.content.map((item) => ({
title: item.title,
author: item.source,
link: `${rootUrl}/article/${item.id}`,
category: item.tagList.map((t) => t.name),
pubDate: timezone(parseDate(item.createTime), +8),
description: unescapeAll(item.content),
}));
ctx.state.data = {
title: '深潮TechFlow',
link: rootUrl,
item: items,
};
};

View File

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

View File

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

View File

@ -0,0 +1,5 @@
module.exports = function (router) {
router.get('/express', require('./express'));
router.get('/newsflash', require('./express'));
router.get('/', require('./index'));
};