mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
@@ -22,7 +22,7 @@ filter 选出想要的内容
|
||||
|
||||
- filter_time: 过滤时间,仅支持数字,单位为秒。返回指定时间范围内的内容。如果条目没有输出`pubDate`或者格式不正确将不会被过滤
|
||||
|
||||
举例 1: `https://rsshub.app/bilibili/fav/2267573/801952073?filter=编曲|摄影`
|
||||
举例 1: `https://rsshub.app/bilibili/fav/2267573/801952073?filter=编曲|摄影`
|
||||
举例 2: <https://rsshub.app/nga/forum/489?filter_time=600>
|
||||
|
||||
filterout 去掉不要的内容
|
||||
|
||||
@@ -1,31 +1,52 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const dateParser = require('@/utils/dateParser');
|
||||
|
||||
const base = 'https://institute.jpmorganchase.com';
|
||||
const url = `${base}/institute/research`;
|
||||
|
||||
const parseDetails = async (link, ctx) => {
|
||||
const fullLink = `${base}${link}`;
|
||||
return ctx.cache.tryGet(fullLink, async () => {
|
||||
const response = await got({
|
||||
url: fullLink,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const authors = [];
|
||||
$('.author-name').each((i, elem) => {
|
||||
authors.push($(elem).text());
|
||||
});
|
||||
|
||||
return {
|
||||
category: $('.eyebrow').text(),
|
||||
author: authors.filter((e) => e).join(', '),
|
||||
title: $('title').text() + ' | ' + $('.copy-wrap p').text(),
|
||||
description: $('.jpmc-wrapper').html(),
|
||||
link: fullLink,
|
||||
pubDate: dateParser($('.date-field').text(), 'MMMM YYYY'),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const url = 'https://www.jpmorganchase.com';
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `${url}/corporate/institute/research.htm`,
|
||||
url,
|
||||
});
|
||||
|
||||
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(),
|
||||
};
|
||||
const items = $('.item a')
|
||||
.map(async (i, item) => {
|
||||
const link = item.attribs.href;
|
||||
return parseDetails(link, ctx);
|
||||
})
|
||||
.get();
|
||||
ctx.state.data = {
|
||||
title: `${title} - JPMorgan Chase Institute`,
|
||||
link: url,
|
||||
description: `${title} - JPMorgan Chase Institute`,
|
||||
item: items,
|
||||
item: await Promise.all(items),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user