import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./got-BBDj7u1e.mjs";import{t as r}from"./timezone-keeL11Io.mjs";import{t as i}from"./invalid-parameter-DLv2wPKB.mjs";import{t as a}from"./valid-host-CeDzTNj_.mjs";import{t as o}from"./description-DD_TyQr-.mjs";import{load as s}from"cheerio";const c={path:`/devlog/:user/:id`,categories:[`game`],example:`/itch/devlog/teamterrible/the-baby-in-yellow`,parameters:{user:`User id, can be found in URL`,id:`Item id, can be found in URL`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`Developer Logs`,maintainers:[`nczitzk`],handler:l,description:"`User id` is the field before `.itch.io` in the URL of the corresponding page, e.g. the URL of [The Baby In Yellow Devlog](https://teamterrible.itch.io/the-baby-in-yellow/devlog) is `https://teamterrible.itch.io/the-baby-in-yellow/devlog`, where the field before `.itch.io` is `teamterrible`.\n\n  `Item id` is the field between `itch.io` and `/devlog` in the URL of the corresponding page, e.g. the URL for [The Baby In Yellow Devlog](https://teamterrible.itch.io/the-baby-in-yellow/devlog) is `https://teamterrible.itch.io/the-baby-in-yellow/devlog`, where the field between `itch.io` and `/devlog` is `the-baby-in-yellow`.\n\n  So the route is [`/itch/devlogs/teamterrible/the-baby-in-yellow`](https://rsshub.app/itch/devlogs/teamterrible/the-baby-in-yellow)."};async function l(c){let l=c.req.param(`user`)??``,u=c.req.param(`id`)??``,d=Number.parseInt(c.req.query(`limit`))||20;if(!a(l))throw new i(`Invalid user`);let f=`https://${l}.itch.io/${u}/devlog`,p=s((await n({method:`get`,url:f})).data),m=p(`.title`).toArray().slice(0,d).map(e=>(e=p(e),{title:e.text(),link:e.attr(`href`),pubDate:r(t(e.text()),8)}));return m=await Promise.all(m.map(t=>e.tryGet(t.link,async()=>{let e=s((await n({method:`get`,url:t.link})).data),r=e(`script[type="application/ld+json"]:contains("@type":"BlogPosting")`),i=JSON.parse(e(r).text());return t.author=i.author.name,t.pubDate=i.datePublished,t.description=o({images:e(`.post_image`).toArray().map(t=>e(t).attr(`src`)),description:e(`.post_body`).html()}),t}))),{title:p(`title`).text(),link:f,item:m}}export{c as route};