From 43476500df54426a887a1f31058204806342f2f0 Mon Sep 17 00:00:00 2001 From: TheresaQWQ Date: Tue, 29 Dec 2020 10:35:10 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E9=B1=BC=E5=A1=98?= =?UTF-8?q?=E7=83=AD=E6=A6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/new-media.md | 4 ++++ lib/router.js | 3 +++ lib/routes/mofish/index.js | 29 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 lib/routes/mofish/index.js diff --git a/docs/new-media.md b/docs/new-media.md index dea896d573..bf7fcddde1 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -2109,3 +2109,7 @@ QueryString: ### 全文 + +## 鱼塘热榜 + + \ No newline at end of file diff --git a/lib/router.js b/lib/router.js index 5bb0f656c3..dfc51508a3 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3780,4 +3780,7 @@ router.get('/nace/blog/:sort?', require('./routes/nace/blog')); // Caixin Latest router.get('/caixin/latest', require('./routes/caixin/latest')); +// 鱼塘热榜 +router.get('/mofish/:id', require('./routes/mofish/index')); + module.exports = router; diff --git a/lib/routes/mofish/index.js b/lib/routes/mofish/index.js new file mode 100644 index 0000000000..f99bf3087d --- /dev/null +++ b/lib/routes/mofish/index.js @@ -0,0 +1,29 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const id = ctx.params.id; + const page = ctx.query.page || 0; + + const url = `https://api.tophub.fun/v2/GetAllInfoGzip?id=${id}&page=${page}`; + + const response = await got({ + method: 'get', + url: url, + }); + + const data = response.data.Data.data; + + const title = `鱼塘热榜`; + + ctx.state.data = { + title: title, + link: `https://mo.fish/`, + description: title, + item: data.map((item) => ({ + title: item.Title, + pubDate: new Date(item.releaseTime).toUTCString(), + link: item.Url, + guid: item.id, + })), + }; +}; \ No newline at end of file