mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 14:07:54 +08:00
add 毕马威洞察 (#1999)
This commit is contained in:
@@ -499,3 +499,7 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
## 马良行
|
||||
|
||||
<Route name="马良行" author="junfengP" example="/mlhang" path="/mlhang" />
|
||||
|
||||
## 毕马威
|
||||
|
||||
<Route name="洞察" author="LogicJake" example="/kpmg/insights" path="/kpmg/insights" />
|
||||
|
||||
@@ -1288,4 +1288,7 @@ router.get('/mlhang', require('./routes/mlhang/latest'));
|
||||
// PlayStation Store
|
||||
router.get('/ps/list/:gridName', require('./routes/ps/list'));
|
||||
|
||||
// 毕马威
|
||||
router.get('/kpmg/insights', require('./routes/kpmg/insights'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
54
lib/routes/kpmg/insights.js
Normal file
54
lib/routes/kpmg/insights.js
Normal file
@@ -0,0 +1,54 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
const host = 'https://home.kpmg';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://home.kpmg/cn/zh/home/insights.html';
|
||||
|
||||
const api = 'https://home.kpmg/search/?all_sites=false&site=cn_zh&language=zh&x1=KPMG_Tab_Type&q1=Insights&sort=KPMG_Filter_Date&facets=false';
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: api,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
});
|
||||
const list = response.data['customer-results'].resultset.results.result;
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const title = item.KPMG_Title;
|
||||
const itemUrl = url.resolve(host, item.KPMG_URL);
|
||||
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
let description = $('div.bodytext-data').html();
|
||||
|
||||
if ($('a.component-link')) {
|
||||
const link = $('a.component-link').attr('href');
|
||||
description += `<p><a href='${link}'>点击下载PDF</a></p>`;
|
||||
}
|
||||
|
||||
const single = {
|
||||
title: title,
|
||||
link: itemUrl,
|
||||
description: description,
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single), 24 * 60 * 60);
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '毕马威洞察',
|
||||
link: link,
|
||||
description: '欢迎浏览毕马威中国网站的知识库。在这里,你可以找到毕马威中国各类定期出版的通讯及各通讯过往的期号。',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user