feat: 添加外接大脑作为获取公众号途径 (#4964)

This commit is contained in:
BugWriter2
2020-06-11 11:35:52 +08:00
committed by GitHub
parent 30e486934a
commit 8e62240e43
3 changed files with 34 additions and 1 deletions
+5 -1
View File
@@ -698,7 +698,7 @@ Supported sub-sites:
<Route author="xfangbao" example="/kuai/1" path="/kuai/:id" />
具体栏目编号,去网站上看标签
具体栏目编号,去网站上看标签
| 网址 | 对应路由 |
| ------------------------------------------------------------------------------------------------- | -------- |
@@ -1042,6 +1042,10 @@ Supported sub-sites:
<Route author="sanmmm" example="/wechat/ershicimi/59" path="/wechat/ershicimi/:id" :paramsDesc="['公众号id, 打开公众号页, 在 URL 中找到 id']"/>
### 公众号 (外接大脑来源)
<Route author="BugWriter2" example="/wechat/wjdn/5d5e683c82339df472988f59" path="/wechat/wjdn/:id" :paramsDesc="['公众号 id, 打开公众号页, 在 URL 中找到 id']"/>
### 公众号栏目 (非推送 & 历史消息)
<Route author="MisteryMonster" example="/wechat/mp/homepage/MzA3MDM3NjE5NQ==/16" path="/wechat/mp/homepage/:biz/:hid/:cid?" :paramsDesc="['公众号id', '分页id', '页内栏目']" radar="1" anticrawler="1">
+1
View File
@@ -487,6 +487,7 @@ router.get('/wechat/miniprogram/plugins', require('./routes/tencent/wechat/minip
router.get('/wechat/tgchannel/:id', require('./routes/tencent/wechat/tgchannel'));
router.get('/wechat/uread/:userid', require('./routes/tencent/wechat/uread'));
router.get('/wechat/ershicimi/:id', require('./routes/tencent/wechat/ershcimi'));
router.get('/wechat/wjdn/:id', require('./routes/tencent/wechat/wjdn'));
router.get('/wechat/mp/homepage/:biz/:hid/:cid?', require('./routes/tencent/wechat/mp'));
// All the Flight Deals
+28
View 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,
};
};