mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
add 新浪科技探索 (#1483)
This commit is contained in:
@@ -2833,3 +2833,14 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
|
|||||||
### 移动支付网
|
### 移动支付网
|
||||||
|
|
||||||
<route name="新闻" author="LogicJake" example="/mpaypass/news" path="/mpaypass/news"/>
|
<route name="新闻" author="LogicJake" example="/mpaypass/news" path="/mpaypass/news"/>
|
||||||
|
|
||||||
|
### 新浪科技
|
||||||
|
|
||||||
|
<route name="科学探索" author="LogicJake" example="/sina/discovery/zx" path="/sina/discovery/:type" :paramsDesc="['订阅分区类型']>
|
||||||
|
|
||||||
|
分类:
|
||||||
|
| zx | twhk | dwzw | zrdl | lskg | smyx | shbk | kjqy |
|
||||||
|
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
|
||||||
|
| 最新 | 天文航空 | 动物植物 | 自然地理 | 历史考古 | 生命医学 | 生活百科 | 科技前沿 |
|
||||||
|
|
||||||
|
</route>
|
||||||
|
|||||||
@@ -1013,4 +1013,7 @@ router.get('/fitchratings/site/:type', require('./routes/fitchratings/site'));
|
|||||||
// 移动支付
|
// 移动支付
|
||||||
router.get('/mpaypass/news', require('./routes/mpaypass/news'));
|
router.get('/mpaypass/news', require('./routes/mpaypass/news'));
|
||||||
|
|
||||||
|
// 新浪科技探索
|
||||||
|
router.get('/sina/discovery/:type', require('./routes/sina/discovery'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
52
lib/routes/sina/discovery.js
Normal file
52
lib/routes/sina/discovery.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
const link = 'https://tech.sina.com.cn/discovery/';
|
||||||
|
const api = 'https://feed.sina.com.cn/api/roll/get?pageid=207&num=10&versionNumber=1.2.4&page=1&encode=utf-8&lid=';
|
||||||
|
|
||||||
|
const map = new Map([
|
||||||
|
['zx', { title: '最新', id: '1795' }],
|
||||||
|
['twhk', { title: '天文航空', id: '1796' }],
|
||||||
|
['dwzw', { title: '动物植物', id: '1797' }],
|
||||||
|
['zrdl', { title: '自然地理', id: '1798' }],
|
||||||
|
['lskg', { title: '历史考古', id: '1799' }],
|
||||||
|
['smyx', { title: '生命医学', id: '1800' }],
|
||||||
|
['shbk', { title: '生活百科', id: '1801' }],
|
||||||
|
['kjqy', { title: '科技前沿', id: '1802' }],
|
||||||
|
]);
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type;
|
||||||
|
const id = map.get(type).id;
|
||||||
|
const title = map.get(type).title;
|
||||||
|
|
||||||
|
const api_url = api + id;
|
||||||
|
const response = await axios.get(api_url);
|
||||||
|
const list = response.data.result.data;
|
||||||
|
|
||||||
|
const out = await Promise.all(
|
||||||
|
list.map(async (data) => {
|
||||||
|
const title = data.title;
|
||||||
|
const date = data.intime * 1000;
|
||||||
|
const itemUrl = data.url;
|
||||||
|
|
||||||
|
const response = await axios.get(itemUrl);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
const description = $('.article').html();
|
||||||
|
|
||||||
|
const single = {
|
||||||
|
title: title,
|
||||||
|
link: itemUrl,
|
||||||
|
description: description,
|
||||||
|
pubDate: new Date(date).toUTCString(),
|
||||||
|
};
|
||||||
|
return Promise.resolve(single);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${title}-新浪科技科学探索`,
|
||||||
|
link: link,
|
||||||
|
item: out,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user