mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
feat: 添加外接大脑作为获取公众号途径 (#4964)
This commit is contained in:
28
lib/routes/tencent/wechat/wjdn.js
Normal file
28
lib/routes/tencent/wechat/wjdn.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
if (!id) {
|
||||
throw Error('Bad category. See <a href="https://docs.rsshub.app/new-media.html#wei-xin-gong-zhong-hao-wai-jie-da-nao-lai-yuan">docs</a>');
|
||||
}
|
||||
|
||||
const currentUrl = `https://www.waijiedanao.com/api/posts?profile=${id}&page=1&limit=20`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const title = response.data.data[0].profile.title;
|
||||
const list = response.data.data.map((item) => ({
|
||||
title: item.title,
|
||||
link: item.link,
|
||||
description: item.digest,
|
||||
pubDate: new Date(item.publishAt).toUTCString(),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `微信公众号 - ${title}`,
|
||||
link: `https://www.waijiedanao.com/accountArtical?publicAccountId=${id}`,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user