mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 04:11:26 +08:00
* fix(utils): 支持微信公众号单图片文章抓取 * fix(utils): 支持输出微信公众号转载文章阅读原文链接 * fix(utils): 修复抓取微信已删除文章时遇到的报错 * refactor: migrate to v2 Co-authored-by: blankyu(于海洋) <blankyu@tencent.com>
24 lines
696 B
JavaScript
24 lines
696 B
JavaScript
const parser = require('@/utils/rss-parser');
|
|
const { finishArticleItem } = require('@/utils/wechat-mp');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { id } = ctx.params;
|
|
const link = `https://github.com/hellodword/wechat-feeds/raw/feeds/${id}.xml`;
|
|
const feed = await parser.parseURL(link);
|
|
|
|
const items = feed.items.map((item) => ({
|
|
title: item.title,
|
|
pubDate: new Date(item.pubDate),
|
|
link: item.link,
|
|
guid: item.link,
|
|
}));
|
|
await Promise.all(items.map(async (item) => await finishArticleItem(ctx, item)));
|
|
|
|
ctx.state.data = {
|
|
title: feed.title,
|
|
link,
|
|
description: feed.description,
|
|
item: items,
|
|
};
|
|
};
|