import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./got-BBDj7u1e.mjs";import{load as r}from"cheerio";const i=`https://comicat.org`,a={path:`/search/:keyword`,categories:[`anime`],example:`/comicat/search/喵萌奶茶屋+跃动青春+720P+简日`,parameters:{keyword:"关键词，请用`+`号连接"},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!0,supportPodcast:!1,supportScihub:!1},name:`搜索关键词`,maintainers:[`Cyang39`],handler:o};async function o(a){let o=a.req.param(`keyword`),{data:s}=await n(`${i}/search.php?keyword=${encodeURIComponent(o)}`),c=r(s),l=c(`#listTable tbody > tr`).toArray().map(e=>({title:c(e).find(`td:nth-child(3)`).text().trim(),link:`${i}/${c(e).find(`td:nth-child(3) a`).attr(`href`)}`,category:c(e).find(`td:nth-child(2)`).text().trim(),author:c(e).find(`td:nth-child(8)`).text().trim()})),u=await Promise.all(l.map(i=>e.tryGet(i.link,async()=>{let{data:e}=await n(i.link),a=r(e);return i.pubDate=t(a(`div.main > div.slayout > div > div.c1 > div:nth-child(1) > div > p:nth-child(4)`).text().split(`发布时间: `)[1]),i.enclosure_url=`magnet:?xt=urn:btih:${a(`#text_hash_id`).text().split(`，特征码：`)[1]}`.trim(),i.enclosure_type=`application/x-bittorrent`,i.description=a(`#btm > div.main > div.slayout > div > div.c2 > div:nth-child(1) > div.intro`).html(),i})));return{title:`Comicat - ${o}`,link:`${i}/search.php?keyword=${encodeURIComponent(o)}`,item:u}}export{a as route};