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:`/bjp/apod`,parameters:{},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`bjp.org.cn/APOD/today.shtml`,`bjp.org.cn/APOD/list.shtml`,`bjp.org.cn/`]}],name:`每日一图`,maintainers:[`HenryQW`],handler:o,url:`bjp.org.cn/APOD/today.shtml`};async function o(a){let o=`https://www.bjp.org.cn`,s=`${o}/APOD/list.shtml`,c=i((await n(s)).data),l=c(`td[align=left] b`).toArray().map(e=>(e=c(e),{title:e.find(`a`).attr(`title`),link:`${o}${e.find(`a`).attr(`href`)}`,pubDate:r(t(e.find(`span`).text().replace(`：`,``),`YYYY-MM-DD`),8)})).toSorted((e,t)=>t.pubDate-e.pubDate).slice(0,a.req.query(`limit`)?Number.parseInt(a.req.query(`limit`),10):10),u=await Promise.all(l.map(t=>e.tryGet(t.link,async()=>{let{data:e}=await n.get(t.link);return t.description=i(e)(`.juzhong`).html(),t})));return{title:c(`head title`).text(),description:`探索宇宙！每天发布一张迷人宇宙的影像，以及由专业天文学家撰写的简要说明。`,link:s,item:u}}export{a as route};