mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 21:47:57 +08:00
33 lines
947 B
JavaScript
33 lines
947 B
JavaScript
const parser = require('@/utils/rss-parser');
|
|
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { id } = ctx.params;
|
|
|
|
const feed = await parser.parseURL(`https://posts.careerengine.us/author/${id}/rss`);
|
|
|
|
const items = await Promise.all(
|
|
feed.items.splice(0, 10).map(async (item) => {
|
|
const response = await got.get(item.link);
|
|
|
|
const $ = cheerio.load(response.data);
|
|
|
|
const single = {
|
|
title: item.title,
|
|
description: $('.post').html(),
|
|
pubDate: item.pubDate,
|
|
link: item.link,
|
|
};
|
|
return Promise.resolve(single);
|
|
})
|
|
);
|
|
|
|
ctx.state.data = {
|
|
title: `微信公众号 - ${feed.title}`,
|
|
link: `https://posts.careerengine.us/author/${id}/posts`,
|
|
description: feed.description,
|
|
item: items,
|
|
};
|
|
};
|