mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
* feat(route): add 腾讯研究院 * Update lib/v2/tisi/index.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/tisi/radar.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * fix(route): change radar docs link Co-authored-by: Tony <TonyRL@users.noreply.github.com>
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
const { parseDate } = require('@/utils/parse-date');
|
|
|
|
const rootUrl = 'https://www.tisi.org';
|
|
|
|
module.exports = async (ctx) => {
|
|
const url = `${rootUrl}/?page_id=11151`;
|
|
|
|
const response = await got(url);
|
|
const $ = cheerio.load(response.data);
|
|
const list = $('div.new-artice-list-box')
|
|
.map((_, item) => ({
|
|
title: $(item).find('p.new-article-title > a').text(),
|
|
link: new URL($(item).find('p.new-article-title > a').attr('href'), rootUrl).href,
|
|
pubDate: parseDate($(item).find('p.new-article-date > span.left-span').text()),
|
|
category: $(item).find('p.new-article-date > span:nth-child(1)').text(),
|
|
}))
|
|
.get();
|
|
|
|
const items = await Promise.all(
|
|
list.map((item) =>
|
|
ctx.cache.tryGet(item.link, async () => {
|
|
const detailResponse = await got(item.link);
|
|
const content = cheerio.load(detailResponse.data);
|
|
item.description = content('div.article-content').html();
|
|
|
|
return item;
|
|
})
|
|
)
|
|
);
|
|
|
|
ctx.state.data = {
|
|
title: '腾讯研究院 - 最近更新',
|
|
link: url,
|
|
item: items,
|
|
};
|
|
};
|