import{t as e}from"./config-BYRrjYC5.mjs";import{t}from"./cache-DUthuMSu.mjs";import{t as n}from"./parse-date-BdYTmLpo.mjs";import{t as r}from"./got-BBDj7u1e.mjs";import{Fragment as i,jsx as a,jsxs as o}from"hono/jsx/jsx-runtime";import{load as s}from"cheerio";import{renderToString as c}from"hono/jsx/dom/server";import{raw as l}from"hono/html";const u=(e,t)=>c(o(i,{children:[e?l(e):null,t?.map(e=>a(`img`,{src:e}))]})),d={path:`/search/:keyword`,categories:[`other`],example:`/sogou/search/rss`,parameters:{keyword:`搜索关键词`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`搜索`,maintainers:[`CaoMeiYouRen`],handler:f};async function f(i){let a=i.req.param(`keyword`),o=`https://www.sogou.com/web?query=${encodeURIComponent(a)}`,c=`sogou-search:${o}`,l=await t.tryGet(c,async()=>{let e=(await r(o)).data,t=s(e);return t(`#main`).find(`.vrwrap`).toArray().map(e=>{let r=t(e),i=r.find(`img`).toArray().map(e=>t(e).attr(`src`)),a=r.find(`h3 a`).first().attr(`href`),o=r.find(`h3`).first().text(),s=r.find(`.text-layout`).first().text()||r.find(`.space-txt`).first().text()||r.find(`[class^="translate"]`).first().text(),c=r.find(`.citeurl span`).first().text()||``,l=n(r.find(`.citeurl .cite-date`).first().text().trim());return{link:a,title:o,description:u(s,i),author:c,pubDate:l}}).filter(e=>e?.link)},e.cache.routeExpire,!1);return{title:`${a} - 搜狗搜索`,description:`${a} - 搜狗搜索`,link:o,item:l}}export{d as route};