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://jwc.njupt.edu.cn`,a={notice:`/1594`,news:`/1596`},o={path:`/jwc/:type?`,categories:[`university`],example:`/njupt/jwc/notice`,parameters:{type:"默认为 `notice`"},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`教务处通知与新闻`,maintainers:[`shaoye`],handler:s,description:`| 通知公告 | 教务快讯 |
| -------- | -------- |
| notice   | news     |`};async function s(o){let s=o.req.param(`type`)??`notice`,c=i+a[s]+`/list.htm`,l=r((await n({method:`get`,url:c,headers:{Referer:i}})).data),u=l(`.content`).find(`a`).slice(0,10).toArray().map(e=>l(e).attr(`href`)),d=l(`.content`).find(`a`).slice(0,10).toArray().map(e=>l(e).attr(`title`)),f=l(`.content tr`).find(`div`).slice(0,10).toArray().map(e=>l(e).text().replace(`发布时间：`,``)),p=await Promise.all(u.map((a,o)=>(a=new URL(a,i).href,a.includes(`.htm`)?e.tryGet(a,async()=>{let e=await n.get(a);if(e.redirectUrls.length!==0)return{title:d[o],link:a,description:`该通知无法直接预览, 请点击原文链接↑查看`,pubDate:t(f[o])};let s=r(e.data);return{title:s(`.Article_Title`).text(),link:a,description:s(`.wp_articlecontent`).html().replaceAll(`src="/`,`src="${new URL(`.`,i).href}`).replaceAll(`href="/`,`href="${new URL(`.`,i).href}`).trim(),pubDate:t(s(`.Article_PublishDate`).text().replace(`发布时间：`,``))}}):{title:d[o],link:a,description:`该通知为文件，请点击原文链接↑下载`,pubDate:t(f[o])}))),m=`通知公告`;return s===`news`&&(m=`教务快讯`),{title:`南京邮电大学 -- `+m,link:c,item:p}}export{o as route};