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{Fragment as r,jsx as i,jsxs as a}from"hono/jsx/jsx-runtime";import{load as o}from"cheerio";import{renderToString as s}from"hono/jsx/dom/server";const c=`https://news.google.com`,l={path:`/news/:category/:locale`,categories:[`new-media`],example:`/google/news/Top stories/hl=en-US&gl=US&ceid=US:en`,parameters:{category:`Category Title`,locale:"locales, could be found behind `?`, including `hl`, `gl`, and `ceid` as parameters"},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`News`,maintainers:[`zoenglinghou`,`pseudoyu`],handler:u};async function u(r){let i=r.req.param(`category`),a=r.req.param(`locale`),s=(await t.tryGet(`google:news:${a}`,async()=>{let t=o(await e(`${c}/?${a}`));return[...t(`a.brSCsc`).toArray().slice(3).map(e=>(e=t(e),{category:e.text(),url:new URL(e.attr(`href`),c).href})),...t(`a.aqvwYd`).toArray().map(e=>(e=t(e),{category:e.text(),url:new URL(e.attr(`href`),c).href}))]})).find(e=>e.category===i).url,l=o(await e(s)),u=[...l(`.UwIKyb`),...l(`.IBr9hb`),...l(`.IFHyqb`)].map(e=>{e=l(e);let t=e.find(`.gPFEn`).text(),r=e.find(`.bInasb span`).text(),i=r?r.replace(/^By\s+/i,``).replaceAll(/\s+\([^)]*\)/g,``).split(/,|\s+&\s+|\s+and\s+/).map(e=>e.trim()).filter(e=>e?![`et al`,`et al.`].some(t=>e.toLowerCase().endsWith(t)):!1).map(e=>({name:e})):[];return{title:t,description:d(e.find(`img.Quavad`).attr(`src`),t),pubDate:n(e.find(`time`).attr(`datetime`)),author:i,link:new URL(e.find(`a.WwrzSb`).first().attr(`href`),c).href}});return{title:l(`title`).text(),link:s,item:u}}const d=(e,t)=>s(a(r,{children:[e?a(r,{children:[i(`img`,{src:e}),i(`br`,{})]}):null,t]}));export{l as route};