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:`/chapter/:id`,categories:[`reading`],example:`/hbooker/chapter/100113279`,parameters:{id:`小说 id, 可在对应小说页 URL 中找到`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`hbooker.com/book/:id`]}],name:`章节`,maintainers:[`keocheung`],handler:o};async function o(a){let o=a.req.param(`id`),s=Number.parseInt(a.req.query(`limit`))||10,c=`https://www.hbooker.com`,{data:l}=await n(`${c}/book/${o}?arr_reverse=1`),u=i(l),d=u(`div.book-chapter-list ul li a`).slice(0,s).toArray().map(e=>(e=u(e),{title:e.text(),link:e.attr(`href`)})),f=await Promise.all(d.map(a=>e.tryGet(a.link,async()=>{let{data:e}=await n(a.link);return a.pubDate=r(t(i(e)(`div.read-hd p span`).eq(2).text().replace(`更新时间：`,``)),8),a})));return{title:`欢乐书客 ${u(`div.book-title h1`).text()}`,link:`${c}/book/${o}`,description:u(`div.book-desc`).text(),image:u(`div.book-cover img`).attr(`src`),item:f}}export{a as route};