Merge branch 'alphardex-master'

This commit is contained in:
DIYgod 2018-09-29 14:42:46 +08:00
commit 309507c836
3 changed files with 35 additions and 0 deletions

View File

@ -1704,3 +1704,15 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
### 电影天堂
<route name="新片精品" author="imgss" example="/dytt/index" path="/dytt/index"/>
### 趣头条
<route name="分类" author="alphardex" example="/qutoutiao/category/1" path="/qutoutiao/category/:cid" :paramsDesc="['分类 id']">
| 推荐 | 热点 | 娱乐 | 健康 | 养生 | 励志 | 科技 | ... |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | --- |
| 255 | 1 | 6 | 42 | 5 | 4 | 7 | ... |
更多的 cid 可通过访问[官网](http://home.qutoutiao.net)切换分类,观察 url 获得。
</route>

View File

@ -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;

View File

@ -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}<br><img referrerpolicy="no-referrer" src="${item.cover[0]}">`,
pubDate: new Date(item.show_time * 1000).toGMTString(),
link: item.url,
})),
};
};