mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 21:47:57 +08:00
feat: 微信公众号 CareerEngine 来源 (#3806)
This commit is contained in:
32
lib/routes/tencent/wechat/ce.js
Normal file
32
lib/routes/tencent/wechat/ce.js
Normal file
@@ -0,0 +1,32 @@
|
||||
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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user