import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./config-BYRrjYC5.mjs";import{t as n}from"./cache-DUthuMSu.mjs";import{t as r}from"./parse-date-BdYTmLpo.mjs";import{t as i}from"./timezone-keeL11Io.mjs";import{t as a}from"./config-not-found-B9AOp828.mjs";import{load as o}from"cheerio";const s={path:`/bbs/:types?`,name:`清水河畔`,maintainers:[`huyyi`],categories:[`university`],url:`bbs.uestc.edu.cn`,example:`/uestc/bbs/newthread`,parameters:{types:"选择内容类型(多选`,`分割），可选值：[newreply,newthread,digest,life,hotlist]。默认为所有。"},features:{requireConfig:[{name:`UESTC_BBS_COOKIE`,optional:!1,description:`河畔的cookie`},{name:`UESTC_BBS_AUTH_KEY`,optional:!1,description:`河畔Header中的authorization字段`}],requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},description:`
::: tip
仅支持自建，您需要设置以下配置才能正常使用：
-   河畔cookie: \`UESTC_BBS_COOKIE\`
-   Header中的授权字段: \`UESTC_BBS_AUTH_KEY\`
:::
`,radar:[{source:[`bbs.uestc.edu.cn/*`],target:`/bbs/newthread`}],handler:async s=>{let{bbsCookie:c,bbsAuthStr:l}=t.uestc;if(!c||!l)throw new a(`未配置 Cookie 或 Authorization。请检查配置。`);let{types:u=`newreply,newthread,digest,life,hotlist`}=s.req.param(),d=await e(`https://bbs.uestc.edu.cn/star/api/v1/index?top_list=${u}`,{headers:{Cookie:c,Referer:`https://bbs.uestc.edu.cn/new`,authorization:l}}),f=Object.entries(d.data.top_list).flatMap(([e,t])=>t.map(t=>({...t,label:e})));return{title:`清水河畔`,link:`https://bbs.uestc.edu.cn/new`,item:await Promise.all(f.map(t=>n.tryGet(`https://bbs.uestc.edu.cn/forum.php?mod=viewthread&tid=${t.thread_id}`,async()=>(t.description=o(await e(`https://bbs.uestc.edu.cn/forum.php?mod=viewthread&tid=${t.thread_id}`,{headers:{Cookie:c,Referer:`https://bbs.uestc.edu.cn`,authorization:l}}))(`div#postlist`).html(),{title:t.subject,link:`https://bbs.uestc.edu.cn/thread/${t.thread_id}`,author:t.author,category:t.label,img:t.icon,pubDate:i(r(t.dateline),8),description:t.description}))))}}};export{s as route};