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{load as i}from"cheerio";const a={path:`/apod`,categories:[`picture`],view:2,example:`/nasa/apod`,parameters:{},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`apod.nasa.govundefined`]}],name:`Astronomy Picture of the Day`,maintainers:[`nczitzk`,`williamgateszhao`],handler:o,url:`apod.nasa.govundefined`};async function o(a){let o=a.req.query(`limit`)?Number.parseInt(a.req.query(`limit`),10):10,s=`https://apod.nasa.gov/apod/archivepix.html`,c=i((await n({method:`get`,url:s})).data),l=c(`body > b > a`).slice(0,o).toArray().map(e=>({title:c(e).text(),link:`https://apod.nasa.gov/apod/${c(e).attr(`href`)}`}));return{title:`NASA Astronomy Picture of the Day`,link:s,item:await Promise.all(l.map(a=>e.tryGet(a.link,async()=>{let e=i((await n({method:`get`,url:a.link})).data),o=`<img src="${e(`img`).attr(`src`)}"> <br> ${e(`body > center`).eq(1).html()} <br> ${e(`body > p`).eq(0).html()}`,s=r(t(a.link.slice(-11,-5),`YYMMDD`),-5);return{title:a.title,description:o,pubDate:s,link:a.link}})))}}export{a as route};