diff --git a/docs/README.md b/docs/README.md index 880284d61..fbf5f8d1f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1704,3 +1704,15 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 ### 电影天堂 + +### 趣头条 + + + +| 推荐 | 热点 | 娱乐 | 健康 | 养生 | 励志 | 科技 | ... | +| ---- | ---- | ---- | ---- | ---- | ---- | ---- | --- | +| 255 | 1 | 6 | 42 | 5 | 4 | 7 | ... | + +更多的 cid 可通过访问[官网](http://home.qutoutiao.net)切换分类,观察 url 获得。 + + diff --git a/router.js b/router.js index ab7c59829..7f830d026 100644 --- a/router.js +++ b/router.js @@ -590,4 +590,7 @@ router.get('/kirara/news', require('./routes/kirara/news')); // 电影天堂 router.get('/dytt/index', require('./routes/dytt/index')); +// 趣头条 +router.get('/qutoutiao/category/:cid', require('./routes/qutoutiao/category')); + module.exports = router; diff --git a/routes/qutoutiao/category.js b/routes/qutoutiao/category.js new file mode 100644 index 000000000..b5161f4a3 --- /dev/null +++ b/routes/qutoutiao/category.js @@ -0,0 +1,20 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const cid = ctx.params.cid; + const url = `http://api.1sapp.com/content/outList?cid=${cid}&tn=1&page=1&limit=10`; + const response = await axios.get(url); + const result = response.data.data.data; + + ctx.state.data = { + title: '趣头条', + link: 'http://home.qutoutiao.net', + description: '趣头条', + item: result.map((item) => ({ + title: item.title, + description: `${item.introduction}
`, + pubDate: new Date(item.show_time * 1000).toGMTString(), + link: item.url, + })), + }; +};