UNPKG

rsshub

Version:
48 lines (46 loc) 1.49 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import "./cache-Bo__VnGm.mjs"; import { t as rss_parser_default } from "./rss-parser-Dtop7M8f.mjs"; import { n as finishArticleItem } from "./wechat-mp-Dq_pp853.mjs"; //#region lib/routes/wechat/wechat2rss.ts const route = { path: "/wechat2rss/:id", categories: ["new-media"], example: "/wechat/wechat2rss/5b925323244e9737c39285596c53e3a2f4a30774", parameters: { id: "公众号 id,打开 `https://wechat2rss.xlab.app/posts/list/`,在 URL 中找到 id;注意不是公众号页的 id,而是订阅的 id" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "公众号(Wechat2RSS 来源)", maintainers: ["TonyRL"], handler }; async function handler(ctx) { const feedUrl = `https://wechat2rss.xlab.app/feed/${ctx.req.param("id")}.xml`; const { title, link, description, image, items: item } = await rss_parser_default.parseURL(feedUrl); let items = item.map((i) => ({ title: i.title, pubDate: parseDate(i.pubDate), link: i.link })); items = await Promise.all(items.map((item$1) => finishArticleItem(item$1))); return { title, link, description, image: image.url, item: items }; } //#endregion export { route };