diff --git a/docs/README.md b/docs/README.md index 0564b0a8a..d69a3cfae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1951,3 +1951,13 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 | plan | program | tech | audio | project | yunying | test | + +### 抽屉 + + + +| 热榜 | 42 区 | 段子 | 图片 | 挨踢 1024 | 你问我答 | +| ---- | ----- | ----- | ---- | --------- | -------- | +| hot | news | scoff | pic | tec | ask | + + diff --git a/router.js b/router.js index 9bfd77d1a..847c833bf 100644 --- a/router.js +++ b/router.js @@ -673,4 +673,6 @@ router.get('/dgtle/trade/:typeId?', require('./routes/dgtle/trade')); // 腾讯游戏开发者社区 router.get('/gameinstitute/community/:tag?', require('./routes/gameinstitute/community')); +// 抽屉新热榜 +router.get('/chouti/:subject?', require('./routes/chouti')); module.exports = router; diff --git a/routes/chouti/index.js b/routes/chouti/index.js new file mode 100644 index 000000000..28ed5b310 --- /dev/null +++ b/routes/chouti/index.js @@ -0,0 +1,33 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + let { subject = '' } = ctx.params; + const host = 'https://m.chouti.com'; + + if (subject === 'hot') { + subject = ''; + } + + const response = await axios({ + method: 'get', + url: `${host}/m/link/more.do?type=hot&subject=${subject}&limit=recent`, + headers: { + Referer: host, + }, + }); + + const resultItem = response.data.result.data.items.map((item) => ({ + title: item.title, + author: item.nick, + description: `${item.title}

评论`, + link: item.url, + pubDate: new Date(item.createtime).toUTCString(), + })); + + ctx.state.data = { + title: '抽屉新热榜', + description: '抽屉新热榜,汇聚每日搞笑段子、热门图片、有趣新闻。它将微博、门户、社区、bbs、社交网站等海量内容聚合在一起,通过用户推荐生成最热榜单。看抽屉新热榜,每日热门、有趣资讯尽收眼底。', + link: host, + item: resultItem, + }; +};