mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
feat: 微信公众号 CareerEngine 来源 (#3806)
This commit is contained in:
@@ -870,6 +870,10 @@ Supported sub-sites:
|
||||
|
||||
<Route author="HenryQW" example="/wechat/csm/huxiu_com" path="/wechat/csm/:id" :paramsDesc="['公众号 id, 打开公众号页, 在 URL 中找到 id']"/>
|
||||
|
||||
### 公众号(CareerEngine 来源)
|
||||
|
||||
<Route author="HenryQW" example="/wechat/ce/595a5b14d7164e53908f1606" path="/wechat/ce/:id" :paramsDesc="['公众号 id, 在 [CareerEngine](https://search.careerengine.us/) 搜索公众号,通过 URL 中找到对应的公众号 id']"/>
|
||||
|
||||
### 公众号(Telegram 频道来源)
|
||||
|
||||
<Route author="LogicJake" example="/wechat/tgchannel/lifeweek" path="/wechat/tgchannel/:id" :paramsDesc="['公众号绑定频道 id']">
|
||||
|
||||
@@ -461,6 +461,7 @@ router.get('/bugly/changelog/:platform', require('./routes/tencent/bugly/changel
|
||||
// wechat
|
||||
router.get('/wechat/wemp/:id', require('./routes/tencent/wechat/wemp'));
|
||||
router.get('/wechat/csm/:id', require('./routes/tencent/wechat/csm'));
|
||||
router.get('/wechat/ce/:id', require('./routes/tencent/wechat/ce'));
|
||||
router.get('/wechat/announce', require('./routes/tencent/wechat/announce'));
|
||||
router.get('/wechat/miniprogram/plugins', require('./routes/tencent/wechat/miniprogram/plugins'));
|
||||
router.get('/wechat/tgchannel/:id', require('./routes/tencent/wechat/tgchannel'));
|
||||
|
||||
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