feat: add route of 'zsnews.cn' (#5818)

This commit is contained in:
Laam Pui 2020-10-08 22:11:44 +08:00 committed by GitHub
parent 1c1de6c09d
commit eb0ec1525f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 0 deletions

View File

@ -791,6 +791,18 @@ category 对应的关键词有
</Route>
## 中山网
### 中山网新闻
<Route author="laampui" example="/zsnews/index/35" path="/zsnews/index/:cateid" :paramsDesc="['类别']">
| 35 | 36 | 37 | 38 | 39 |
| ---- | ---- | ---- | ---- | ---- |
| 本地 | 镇区 | 热点 | 社会 | 综合 |
</Route>
## 中時電子報
### 新聞

View File

@ -3163,6 +3163,9 @@ router.get('/shiep/:type', require('./routes/universities/shiep/index'));
router.get('/fjnews/:city/:limit', require('./routes/fjnews/fznews'));
router.get('/fjnews/jjnews', require('./routes/fjnews/jjnews'));
// 中山网新闻
router.get('/zsnews/index/:cateid', require('./routes/zsnews/index'));
// 孔夫子旧书网
router.get('/kongfz/people/:id', require('./routes/kongfz/people'));
router.get('/kongfz/shop/:id/:cat?', require('./routes/kongfz/shop'));

View File

@ -0,0 +1,18 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
ctx.params.cateid = ctx.params.cateid || '35';
const response = await got.get(`http://www.zsnews.cn/api/mobile/getlist.html?cateid=${ctx.params.cateid}`);
ctx.state.data = {
title: '中山新闻',
link: 'https://www.zsnews.cn/',
item: response.data.map((item) => ({
guid: item.id,
title: item.title,
description: item.title,
link: item.url,
})),
};
};