import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./cache-DUthuMSu.mjs";import{load as n}from"cheerio";const r={path:`/article/:id`,name:`章节`,url:`www.69shuba.cx`,maintainers:[`eternasuno`],example:`/69shu/article/47117`,parameters:{id:`小说 id, 可在对应小说页 URL 中找到`},categories:[`reading`],features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`www.69shuba.cx/book/:id.htm`],target:`/article/:id`}],handler:async e=>{let{id:t}=e.req.param(),r=`https://www.69shuba.cx/book/${t}.htm`,o=n(await a(r)),s=await Promise.all(o(`.qustime li>a`).toArray().map(e=>i(e.attribs.href)));return{title:o(`h1>a`).text(),description:o(`.navtxt>p:first-of-type`).text(),link:r,item:s,image:o(`.bookimg2>img`).attr(`src`),author:o(`.booknav2>p:first-of-type>a`).text(),language:`zh-cn`}}},i=e=>t.tryGet(e,async()=>{let t=n(await a(e)),{articleid:r,chapterid:i,chaptername:c}=o(/bookinfo\s?=\s?{[\S\s]+?}/,t(`head>script:not([src])`).text()),l=o(/_\d+\s?=\s?{[\S\s]+?}/,t(`.txtnav+script`).text());return{title:c,description:s(t(`.txtnav`).html()||``,r,i,l),link:e}}),a=async(t,n=`gbk`)=>new TextDecoder(n).decode(await e(t,{responseType:`arrayBuffer`})),o=(e,t)=>{let n={},r=e.exec(t);if(r)for(let e of r[0].matchAll(/(\w+):\s?["']?([\S\s]+?)["']?[\n,}]/g))n[e[1]]=e[2];return n},s=(e,t,n,r)=>{if(!e||e.length<10)return e;let i={},a=Number(t)+3061711,o=Number(n)+3421001;for(let e of Object.keys(r))i[(Number(e)^o)-a]=(Number(r[e])^o)-a;return e.replaceAll(/\u2003|\n/g,``).split(`<br><br>`).flatMap((e,t,n)=>(i[t]?n[i[t]]:e).split(`<br>`)).slice(1,-2).join(`<br><br>`)};export{r as route};