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={path:`/std/:category{.+}?`,name:`即時`,maintainers:[`TonyRL`],example:`/stheadline/std/realtimenews`,parameters:{category:"分類路徑，URL 中 `www.stheadline.com/` 後至中文分類名前部分，預設為 `realtimenews`"},radar:[{source:[`www.stheadline.com/theme/:category/chineseCategory`,`www.stheadline.com/:category/:chineseCategory`],target:`/std/:category`}],handler:a};async function a(i){let{category:a=`realtimenews`}=i.req.param(),o=`https://www.stheadline.com/${a}`,{data:s}=await n(o),c=r(s),l=c(`.news-block .news-detail > a`).toArray().map(e=>(e=c(e),{title:e.find(`.title`).text(),link:new URL(e.attr(`href`),`https://www.stheadline.com`).href}));return l=await Promise.all(l.map(i=>e.tryGet(i.link,async()=>{let{data:e}=await n(i.link),a=r(e);return{...i,description:a(`.content-body`).html(),pubDate:t(a(`meta[property="article:published_time"]`).attr(`content`)),category:a(`meta[name='keyword']`).attr(`content`).split(`,`),guid:i.link.slice(0,i.link.lastIndexOf(`/`))}}))),{title:c(`head meta[name="title"]`).attr(`content`)||c(`head title`).text(),description:c(`meta[name=description]`).attr(`content`),image:`https://www.sthlstatic.com/sthl/assets/favicon/android-icon-192x192.png`,language:`zh-HK`,link:o,item:l}}export{i as route};