mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 22:19:40 +08:00
feat: new route 新浪财经-国內 (#4558)
This commit is contained in:
@@ -10,6 +10,12 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="HenryQW" example="/finviz/news/AAPL" path="/finviz/news/:ticker" :paramsDesc="['股票代码']"/>
|
<Route author="HenryQW" example="/finviz/news/AAPL" path="/finviz/news/:ticker" :paramsDesc="['股票代码']"/>
|
||||||
|
|
||||||
|
## 新浪财经
|
||||||
|
|
||||||
|
### 新浪财经-国內
|
||||||
|
|
||||||
|
<Route author="yubinbai" example="/sina/finance" path="/sina/finance" />
|
||||||
|
|
||||||
## WEEX 华尔街见闻旗下全球投资线上品牌
|
## WEEX 华尔街见闻旗下全球投资线上品牌
|
||||||
|
|
||||||
### 资讯
|
### 资讯
|
||||||
|
|||||||
@@ -1200,6 +1200,9 @@ router.get('/sina/rollnews', require('./routes/sina/rollnews'));
|
|||||||
// 新浪专栏创事记
|
// 新浪专栏创事记
|
||||||
router.get('/sina/csj', require('./routes/sina/chuangshiji'));
|
router.get('/sina/csj', require('./routes/sina/chuangshiji'));
|
||||||
|
|
||||||
|
// 新浪财经-国內
|
||||||
|
router.get('/sina/finance', require('./routes/sina/finance'));
|
||||||
|
|
||||||
// Animen
|
// Animen
|
||||||
router.get('/animen/news/:type', require('./routes/animen/news'));
|
router.get('/animen/news/:type', require('./routes/animen/news'));
|
||||||
|
|
||||||
|
|||||||
37
lib/routes/sina/finance.js
Normal file
37
lib/routes/sina/finance.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const url = 'http://feed.sina.com.cn/api/roll/get?pageid=155&lid=1686&num=20&versionNumber=1.2.8&page=1&encode=utf-8';
|
||||||
|
const response = await got.get(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 link = data.url;
|
||||||
|
|
||||||
|
const description = await ctx.cache.tryGet(`sina-finance: ${link}`, async () => {
|
||||||
|
const response = await got.get(link);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
return $('#artibody').html();
|
||||||
|
});
|
||||||
|
|
||||||
|
const single = {
|
||||||
|
title: title,
|
||||||
|
link,
|
||||||
|
description: description,
|
||||||
|
pubDate: new Date(date).toUTCString(),
|
||||||
|
};
|
||||||
|
return Promise.resolve(single);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '新浪财经-国內',
|
||||||
|
link: 'http://finance.sina.com.cn/china/',
|
||||||
|
item: out,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user