import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./cache-DUthuMSu.mjs";import{t as n}from"./parse-date-BdYTmLpo.mjs";import{t as r}from"./timezone-keeL11Io.mjs";import{load as i}from"cheerio";const a={path:`/news/:category?`,categories:[`university`],example:`/tsinghua/news`,parameters:{category:"分类，可在对应分类页 URL 中找到，留空为 `zxdt`"},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`清华新闻`,radar:[{source:[`www.tsinghua.edu.cn/news/:category`],target:(e,t)=>`/tsinghua/news/${new URL(t).pathname.split(`/`).pop()?.replace(`.htm`,``)}`}],maintainers:[`TonyRL`],url:`www.tsinghua.edu.cn/news.htm`,handler:o};async function o(a){let{category:o=`zxdt`}=a.req.param(),s=`https://www.tsinghua.edu.cn`,c=`${s}/news/${o}.htm`,l=i(await e(c)),u=[...l(`.left li a`).toArray().map(e=>{let t=l(e),r=t.find(`.sj`);return{title:t.find(`.bt`).text().trim(),link:new URL(t.attr(`href`),s).href?.replace(`http://`,`https://`),pubDate:n(`${r.find(`span`).text().trim()}.${r.find(`p`).text().trim()}`,`YYYY.MM.DD`)}}),...l(`.qhrw2_first`).length?[{title:l(`.qhrw2_first .bt`).text().trim(),link:l(`.qhrw2_first a`).attr(`href`)?.replace(`http://`,`https://`),pubDate:n(`${l(`.qhrw2_first .sj span`).text().trim()}.${l(`.qhrw2_first .sj p`).text().trim()}`,`YYYY.MM.DD`)}]:[]],d=await Promise.all(u.map(a=>t.tryGet(a.link,async()=>{if(!a.link?.startsWith(`https://www.tsinghua.edu.cn/info/`))return a;let t=i(await e(a.link));return a.description=t(`.v_news_content`).html(),a.pubDate=r(n(t(`.sj p`).text().trim(),`YYYY年MM月DD日 HH:mm:ss`),8),a})));return{title:l(`head title`).text(),link:c,item:d}}export{a as route};