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=`http://kw.beijing.gov.cn`,a={path:`/beijing/kw/:channel`,name:`Unknown`,maintainers:[`Fatpandac`],handler:o};async function o(a){let o=`${i}/col/${a.req.param(`channel`)}/index.html`,s=r((await n.get(o)).data),c=s(`a.bt_link`).last().text().replace(`>`,``),l=(s(`div.left.zhengce_right > script[language="javascript"]`).html()||s(`div.centent_width > script[language="javascript"]`).html()).match(/urls\[i]='(.*?)';headers\[i]="(.*?)";year\[i]='(\d+)';month\[i]='(\d+)';day\[i]='(\d+)';/g).slice(0,a.req.query(`limit`)?Number.parseInt(a.req.query(`limit`)):25).map(e=>{let n=e.match(/urls\[i]='(.*?)';headers\[i]="(.*?)";year\[i]='(\d+)';month\[i]='(\d+)';day\[i]='(\d+)';/);return{title:r(n[2])(`a`).attr(`title`)||n[2],link:new URL(n[1],i).href,pubDate:t(`${n[3]}-${n[4]}-${n[5]}`,`YYYY-MM-DD`)}});return l=await Promise.all(l.map(t=>e.tryGet(t.link,async()=>{let e=r((await n.get(t.link)).data);return t.description=e(`#zoom`).html()||e(`div.left.zhengce_right`).html(),t}))),{title:`北京市科学技术委员会、中关村科技园区管理委员会 - ${c}`,link:o,item:l}}export{a as route};