mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
feat(route): wechat2rss (#11874)
This commit is contained in:
+5
-1
@@ -3944,12 +3944,16 @@ column 为 third 时可选的 category:
|
||||
|
||||
### 公众号(feeddd 来源)
|
||||
|
||||
<Route author="TonyRL Rongronggg9" example="/wechat/feeddd/6131e1441269c358aa0e2141" path="/wechat/feeddd/:id" :paramsDesc="['公众号 id, 打开 `https://feeddd.org/feeds` 或 `https://cdn.jsdelivr.net/gh/feeddd/feeds/feeds_all_rss.txt`, 在 URL 中找到 id; 注意不是公众号页的 id, 而是订阅的 id']"/>
|
||||
<Route author="TonyRL Rongronggg9" example="/wechat/feeddd/6131e1441269c358aa0e2141" path="/wechat/feeddd/:id" :paramsDesc="['公众号 id,打开 `https://feeddd.org/feeds` 或 `https://cdn.jsdelivr.net/gh/feeddd/feeds/feeds_all_rss.txt`,在 URL 中找到 id;注意不是公众号页的 id,而是订阅的 id']"/>
|
||||
|
||||
### 公众号(自由微信来源)
|
||||
|
||||
见 [#自由微信](#zi-you-wei-xin)
|
||||
|
||||
### 公众号(Wechat2RSS 来源)
|
||||
|
||||
<Route author="TonyRL" example="/wechat/wechat2rss/5b925323244e9737c39285596c53e3a2f4a30774" path="/wechat/wechat2rss/:id" :paramsDesc="['公众号 id,打开 `https://wechat2rss.xlab.app/posts/list/`,在 URL 中找到 id;注意不是公众号页的 id,而是订阅的 id']" radar="1"/>
|
||||
|
||||
### 公众号栏目 (非推送 & 历史消息)
|
||||
|
||||
<Route author="MisteryMonster" example="/wechat/mp/homepage/MzA3MDM3NjE5NQ==/16" path="/wechat/mp/homepage/:biz/:hid/:cid?" :paramsDesc="['公众号id', '分页id', '页内栏目']" radar="1" rssbud="1" anticrawler="1">
|
||||
|
||||
@@ -9,5 +9,6 @@ module.exports = {
|
||||
'/mp/msgalbum/:biz/:aid': ['MisteryMonster'],
|
||||
'/tgchannel/:id/:mpName?/:searchQueryType?': ['LogicJake', 'Rongronggg9'],
|
||||
'/uread/:userid': ['kt286'],
|
||||
'/wechat2rss/:id': ['TonyRL'],
|
||||
'/wxnmh/:id': ['laampui'],
|
||||
};
|
||||
|
||||
@@ -73,4 +73,15 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'xlab.app': {
|
||||
_name: '微信',
|
||||
wechat2rss: [
|
||||
{
|
||||
title: '公众号(wechat2rss 来源)',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#wei-xin',
|
||||
source: ['/feed/:id'],
|
||||
target: (params) => `/wechat/wechat2rss/${params.id.replace('.xml', '')}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,5 +9,6 @@ module.exports = function (router) {
|
||||
router.get('/mp/msgalbum/:biz/:aid', require('./msgalbum'));
|
||||
router.get('/tgchannel/:id/:mpName?/:searchQueryType?', require('./tgchannel'));
|
||||
router.get('/uread/:userid', require('./uread'));
|
||||
router.get('/wechat2rss/:id', require('./wechat2rss'));
|
||||
router.get('/wxnmh/:id', require('./wxnmh'));
|
||||
};
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
const parser = require('@/utils/rss-parser');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { finishArticleItem } = require('@/utils/wechat-mp');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const baseUrl = 'https://wechat2rss.xlab.app';
|
||||
const feedUrl = `${baseUrl}/feed/${id}.xml`;
|
||||
|
||||
const { title, link, description, image, items: item } = await parser.parseURL(feedUrl);
|
||||
|
||||
let items = item.map((i) => ({
|
||||
title: i.title,
|
||||
pubDate: parseDate(i.pubDate),
|
||||
link: i.link,
|
||||
}));
|
||||
|
||||
items = await Promise.all(items.map((item) => finishArticleItem(ctx, item)));
|
||||
|
||||
ctx.state.data = {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
image: image.url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user