import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./invalid-parameter-DLv2wPKB.mjs";import{t as r}from"./valid-host-CeDzTNj_.mjs";import{t as i}from"./rss-parser-CtkSf1Et.mjs";const a={path:`/subscribe/:user`,categories:[`blog`],view:1,example:`/substack/subscribe/mangoread`,parameters:{user:`Username of the Substack`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`Substack Subscription`,maintainers:[`pseudoyu`],handler:o};async function o(a){let o=a.req.param(`user`);if(!r(o))throw new n(`Invalid user`);let s=await e(`https://${o}.substack.com/feed`),c=await i.parseString(s);return{title:c.title??`Substack`,description:c.description??`${o}'s Substack`,link:c.link??`https://${o}.substack.com`,image:c.image?.url??``,item:c.items.map(e=>({title:e.title??`Untitled`,description:e[`content:encoded`]??e.content??``,link:e.link??``,pubDate:e.pubDate?t(e.pubDate):void 0,guid:e.guid??``,author:e.creator??o}))}}export{a as route};