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')); +};