From 0f3a0b76d4d8677b70471c0028dde86caefd77dd Mon Sep 17 00:00:00 2001
From: Ethan Shen <42264778+nczitzk@users.noreply.github.com>
Date: Thu, 16 Jun 2022 20:06:47 +0800
Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E6=B7=B1=E6=BD=AETechFlow?=
=?UTF-8?q?=20(#9965)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat(route): add 深潮TechFlow
* fix: add category
---
docs/new-media.md | 15 ++++++++++++++
lib/v2/techflow520/index.js | 34 ++++++++++++++++++++++++++++++++
lib/v2/techflow520/maintainer.js | 4 ++++
lib/v2/techflow520/newsflash.js | 32 ++++++++++++++++++++++++++++++
lib/v2/techflow520/radar.js | 19 ++++++++++++++++++
lib/v2/techflow520/router.js | 4 ++++
6 files changed, 108 insertions(+)
create mode 100644 lib/v2/techflow520/index.js
create mode 100644 lib/v2/techflow520/maintainer.js
create mode 100644 lib/v2/techflow520/newsflash.js
create mode 100644 lib/v2/techflow520/radar.js
create mode 100644 lib/v2/techflow520/router.js
diff --git a/docs/new-media.md b/docs/new-media.md
index b854f71846..db5f345db6 100644
--- a/docs/new-media.md
+++ b/docs/new-media.md
@@ -3108,6 +3108,21 @@ column 为 third 时可选的 category:
+## 深潮 TechFlow
+
+### 分类
+
+
+
+| 头条 | 元宇宙 | 项目 | DeFi | 矿业 | 隐私计算 | 碳中和 | 活动 | NFT | 产业 |
+| -- | --- | -- | ---- | -- | ---- | --- | -- | --- | -- |
+
+
+
+### 快讯
+
+
+
## 深焦
### 分类
diff --git a/lib/v2/techflow520/index.js b/lib/v2/techflow520/index.js
new file mode 100644
index 0000000000..e145c58341
--- /dev/null
+++ b/lib/v2/techflow520/index.js
@@ -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,
+ };
+};
diff --git a/lib/v2/techflow520/maintainer.js b/lib/v2/techflow520/maintainer.js
new file mode 100644
index 0000000000..bceaf4ee30
--- /dev/null
+++ b/lib/v2/techflow520/maintainer.js
@@ -0,0 +1,4 @@
+module.exports = {
+ '/newsflash': ['nczitzk'],
+ '/:category?': ['nczitzk'],
+};
diff --git a/lib/v2/techflow520/newsflash.js b/lib/v2/techflow520/newsflash.js
new file mode 100644
index 0000000000..45cbf7eb47
--- /dev/null
+++ b/lib/v2/techflow520/newsflash.js
@@ -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,
+ };
+};
diff --git a/lib/v2/techflow520/radar.js b/lib/v2/techflow520/radar.js
new file mode 100644
index 0000000000..6703a41813
--- /dev/null
+++ b/lib/v2/techflow520/radar.js
@@ -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',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/techflow520/router.js b/lib/v2/techflow520/router.js
new file mode 100644
index 0000000000..2f58f00ba2
--- /dev/null
+++ b/lib/v2/techflow520/router.js
@@ -0,0 +1,4 @@
+module.exports = function (router) {
+ router.get('/newsflash', require('./newsflash'));
+ router.get('/:category?', require('./index'));
+};