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{load as r}from"cheerio";const i=/<img data-reference="image" data-document-id="cms\/api\/amp\/image\/([A-Za-z0-9]+)">/,a={path:`/:market/:name/:id`,parameters:{market:`Market code. Find it in MSN url, e.g. zh-tw`,name:`Name of the channel. Find it in MSN url, e.g. Bloomberg`,id:`ID of the channel (always starts with sr-vid). Find it in MSN url, e.g. sr-vid-08gw7ky4u229xjsjvnf4n6n7v67gxm0pjmv9fr4y2x9jjmwcri4s`},categories:[`traditional-media`],example:`/zh-tw/Bloomberg/sr-vid-08gw7ky4u229xjsjvnf4n6n7v67gxm0pjmv9fr4y2x9jjmwcri4s`,description:`MSN News`,features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportRadar:!0},radar:[{source:[`www.msn.com/:market/channel/source/:name/:id`],target:`/:market/:name/:id`}],name:`News`,maintainers:[`KTachibanaM`],handler:async a=>{let{market:o,name:s,id:c}=a.req.param(),l=c;l.startsWith(`sr-`)&&(l=l.slice(3));let u=r(await e(`https://www.msn.com/${o}/channel/source/${s}/${c}`))(`head`).attr(`data-client-settings`)??`{}`,d=JSON.parse(u).fd_muid,f=await e(`https://assets.msn.com/service/news/feed/pages/providerfullpage?market=${o}&query=newest&CommunityProfileId=${l}&apikey=0QfOX3Vn51YCzitbLaRkTTBadtWpgTN8NZLW0C1SEM&user=m-${d}`),p=await Promise.all(f.sections[0].cards.map(async r=>{let a=``,s=r.url,c=URL.parse(s)?.pathname.split(`/`).pop();return c?.startsWith(`ar-`)&&(c=c.slice(3),a=(await t.tryGet(c,async()=>(await e(`https://assets.msn.com/content/view/v2/Detail/${o}/${c}`)).body)).replace(i,`<img src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/$1.img">`)),{title:r.title,link:s,description:r.abstract,content:{html:a},pubDate:n(r.publishedDateTime),category:[r.category]}}));return{title:s,image:`https://www.msn.com/favicon.ico`,link:`https://www.msn.com/${o}/channel/source/${s}/${c}`,item:p}}};export{a as route};