增加摩根大通研究所 (#1513)

* feat: support jpmorganchase

* fix: add host to link
This commit is contained in:
Howel
2019-02-01 15:46:41 +08:00
committed by DIYgod
parent aa33cb1a81
commit ad2e87d3a9
3 changed files with 38 additions and 0 deletions

View File

@@ -2876,3 +2876,7 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
### 日报 | D2 资源库 ### 日报 | D2 资源库
<route name="日报 | D2 资源库" author="Andiedie" example="/d2/daily" path="/d2/daily"/> <route name="日报 | D2 资源库" author="Andiedie" example="/d2/daily" path="/d2/daily"/>
### 加摩根大通研究所
<route name="新闻" author="howel.52" example="/jpmorganchase" path="/jpmorganchase"/>

View File

@@ -1040,6 +1040,9 @@ router.get('/ebb', require('./routes/ebb'));
// Indienova // Indienova
router.get('/indienova/article', require('./routes/indienova/article')); router.get('/indienova/article', require('./routes/indienova/article'));
// JPMorgan Chase Institute
router.get('/jpmorganchase', require('./routes/jpmorganchase/research'));
// 美拍 // 美拍
router.get('/meipai/user/:uid', require('./routes/meipai/user')); router.get('/meipai/user/:uid', require('./routes/meipai/user'));

View File

@@ -0,0 +1,31 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const url = 'https://www.jpmorganchase.com';
module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: `${url}/corporate/institute/research.htm`,
});
const title = 'All Reports';
const $ = cheerio.load(response.data);
const items = $('.globalphilsect')
.map((index, item) => {
item = $(item);
return {
title: item.find('.chaseanalytics-track-link').text(),
link: `${url}${item.find('.chaseanalytics-track-link').attr('href')}`,
description: item.find('.lead-in + p').text(),
pubDate: item.find('.lead-in').text(),
};
})
.get();
ctx.state.data = {
title: `${title} - JPMorgan Chase Institute`,
link: url,
description: `${title} - JPMorgan Chase Institute`,
item: items,
};
};