import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./got-BBDj7u1e.mjs";import{t as r}from"./timezone-keeL11Io.mjs";import{load as i}from"cheerio";const a={path:`/ndrc/xwdt/:category{.+}?`,name:`新闻动态`,example:`/gov/ndrc/xwdt`,parameters:{category:`分类，见下表，默认为新闻发布`},maintainers:[`nczitzk`],categories:[`government`],handler:o,radar:[{title:`中华人民共和国国家发展和改革委员会 - 新闻动态`,source:[`ndrc.gov.cn/xwdt/:category*`],target:e=>{let t=e.category;return`/gov/ndrc/xwdt/${t?`/${t.endsWith(`/`)?t:`${t}/`}`:`/`}`}}],description:`| 新闻发布 | 通知通告 | 委领导动态 | 司局动态 | 地方动态 |
| -------- | -------- | ---------- | -------- | -------- |
| xwfb     | tzgg     | wlddt      | sjdt     | dfdt     |`};async function o(a){let o=a.req.param(`category`)||`xwfb`,s=a.req.query(`limit`)?Number.parseInt(a.req.query(`limit`),10):25,c=`https://www.ndrc.gov.cn`,l=o.includes(`dt`)?`${c}/xwdt/dt/${o}`:`${c}/xwdt/${o}`,u=i((await n({method:`get`,url:l})).data),d=u(`.u-list li a`).slice(0,s).toArray().map(e=>{e=u(e);let t=e.attr(`href`);return t.indexOf(`../../..`)===0?t=`${c}${t.replace(`../../..`,``)}`:t.indexOf(`.`)===0&&(t=`${l}${t.replace(`.`,``)}`),{title:e.text(),link:t}}),f=await Promise.all(d.map(a=>e.tryGet(a.link,async()=>{let e=i((await n({method:`get`,url:a.link})).data);return a.description=(e(`.TRS_Editor`).html()||e(`.article_con`).html()||``)+(e(`.attachment`).html()||``),a.pubDate=r(t(e(`meta[name="PubDate"]`).attr(`content`)),8),a})));return{title:u(`title`).text(),link:l,item:f}}export{a as route};