Merge pull request #6565 from TheresaQWQ/master

feat: add mofish
This commit is contained in:
NeverBehave
2021-01-10 02:39:16 -05:00
committed by GitHub
3 changed files with 37 additions and 0 deletions
+4
View File
@@ -2113,3 +2113,7 @@ QueryString:
### 全文
<Route author="HenryQW" example="/zzz" path="/zzz/index"/>
## 鱼塘热榜
<Route author="TheresaQWQ" example="/mofish/2" path="/mofish/:id" :paramsDesc="['分类id,可以在 https://api.tophub.fun/GetAllType 获取']" />
+4
View File
@@ -3786,6 +3786,9 @@ 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'));
// Mcdonalds
router.get('/mcdonalds/:category', require('./routes/mcdonalds/news'));
@@ -3814,4 +3817,5 @@ router.get('/simpread/changelog', require('./routes/simpread/changelog'));
// Radio Free Asia
router.get('/rfa/:language?/:channel?/:subChannel?', require('./routes/rfa/index'));
module.exports = router;
+29
View File
@@ -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,
})),
};
};