mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-14 09:12:01 +08:00
@@ -22,7 +22,7 @@ filter 选出想要的内容
|
|||||||
|
|
||||||
- filter_time: 过滤时间,仅支持数字,单位为秒。返回指定时间范围内的内容。如果条目没有输出`pubDate`或者格式不正确将不会被过滤
|
- 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>
|
举例 2: <https://rsshub.app/nga/forum/489?filter_time=600>
|
||||||
|
|
||||||
filterout 去掉不要的内容
|
filterout 去掉不要的内容
|
||||||
|
|||||||
@@ -1,31 +1,52 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
const cheerio = require('cheerio');
|
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) => {
|
module.exports = async (ctx) => {
|
||||||
const response = await got({
|
const response = await got({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `${url}/corporate/institute/research.htm`,
|
url,
|
||||||
});
|
});
|
||||||
|
|
||||||
const title = 'All Reports';
|
const title = 'All Reports';
|
||||||
const $ = cheerio.load(response.data);
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
const items = $('.globalphilsect')
|
const items = $('.item a')
|
||||||
.map((index, item) => {
|
.map(async (i, item) => {
|
||||||
item = $(item);
|
const link = item.attribs.href;
|
||||||
return {
|
return parseDetails(link, ctx);
|
||||||
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();
|
.get();
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: `${title} - JPMorgan Chase Institute`,
|
title: `${title} - JPMorgan Chase Institute`,
|
||||||
link: url,
|
link: url,
|
||||||
description: `${title} - JPMorgan Chase Institute`,
|
description: `${title} - JPMorgan Chase Institute`,
|
||||||
item: items,
|
item: await Promise.all(items),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user