From ad2e87d3a9f64ab5585bae0846e1829907126c6c Mon Sep 17 00:00:00 2001
From: Howel <401738000@qq.com>
Date: Fri, 1 Feb 2019 15:46:41 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=91=A9=E6=A0=B9=E5=A4=A7?=
=?UTF-8?q?=E9=80=9A=E7=A0=94=E7=A9=B6=E6=89=80=20(#1513)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat: support jpmorganchase
* fix: add host to link
---
docs/README.md | 4 ++++
lib/router.js | 3 +++
lib/routes/jpmorganchase/research.js | 31 ++++++++++++++++++++++++++++
3 files changed, 38 insertions(+)
create mode 100644 lib/routes/jpmorganchase/research.js
diff --git a/docs/README.md b/docs/README.md
index 6f3fb692dc..415262cf79 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2876,3 +2876,7 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
### 日报 | D2 资源库
+
+### 加摩根大通研究所
+
+
diff --git a/lib/router.js b/lib/router.js
index c57051a540..679c06e71c 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -1040,6 +1040,9 @@ router.get('/ebb', require('./routes/ebb'));
// Indienova
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'));
diff --git a/lib/routes/jpmorganchase/research.js b/lib/routes/jpmorganchase/research.js
new file mode 100644
index 0000000000..20da1c8005
--- /dev/null
+++ b/lib/routes/jpmorganchase/research.js
@@ -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,
+ };
+};