import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./config-BYRrjYC5.mjs";import{t as n}from"./cache-DUthuMSu.mjs";import{t as r}from"./config-not-found-B9AOp828.mjs";import{t as i}from"./utils-CKiYulqV.mjs";import{load as a}from"cheerio";const o={path:`/product/:id`,categories:[`shopping`],example:`/smzdm/product/zm5vzpe`,parameters:{id:`商品 id，网址上直接可以看到`},features:{requireConfig:[{name:`SMZDM_COOKIE`,description:`什么值得买登录后的 Cookie 值`}],requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`wiki.smzdm.com/p/:id`],target:`/product/:id`}],name:`商品`,maintainers:[`chesha1`],handler:s};async function s(o){if(!t.smzdm.cookie)throw new r(`什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE`);let s=`https://wiki.smzdm.com/p/${o.req.param(`id`)}`,c=a(await e(s,{headers:i()})),l=c(`title`).text(),u=c(`ul#feed-main-list li`).toArray().map(e=>{let t=c(e).find(`img`).attr(`alt`),n=c(e).find(`h5.feed-block-title a`).attr(`href`),r=c(e).find(`.z-highlight`).text();return{title:t+` `+r,link:n,description:c(e).find(`.feed-block-descripe`).text().replaceAll(/\s+/g,``)}});return{title:l,link:s,item:(await Promise.all(u.map(t=>n.tryGet(t.link,async()=>{let n=a(await e(t.link,{headers:i()}));return n(`span.old`).length>0?null:(t.pubDate=n(`meta[name="weibo:webpage:create_at"]`).attr(`content`),t.description===`阅读全文`&&(t.description=n(`p[itemprop="description"]`).first().html()),t)})))).filter(e=>e!==null)}}export{o as route};