import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{n as t,o as n,t as r}from"./utils-rnNdYcza.mjs";const i={path:`/trending/:category/:type`,categories:[`programming`],example:`/juejin/trending/ios/monthly`,parameters:{category:{description:`分类名`,options:[{value:`android`,label:`Android`},{value:`frontend`,label:`前端`},{value:`ios`,label:`iOS`},{value:`backend`,label:`后端`},{value:`design`,label:`设计`},{value:`product`,label:`产品`},{value:`freebie`,label:`工具资源`},{value:`article`,label:`阅读`},{value:`ai`,label:`人工智能`},{value:`devops`,label:`运维`},{value:`all`,label:`全部`}],default:`all`},type:{description:`类型`,options:[{value:`weekly`,label:`本周最热`},{value:`monthly`,label:`本月最热`},{value:`historical`,label:`历史最热`}],default:`weekly`}},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`热门`,maintainers:[`moaix`],handler:a};async function a(i){let{category:a,type:o}=i.req.param(),s=``,c=``,l=`recommended`,u=(await t()).find(e=>e.category_url===a);u&&(s=u.category_id,c=u.category_name,l=u.category_url);let d={monthly:{period:`month`,title:`本月`,link:`monthly_hottest`,sort_type:30},weekly:{period:`week`,title:`本周`,link:`weekly_hottest`,url:`get_entry_by_period`,sort_type:7},historical:{period:``,title:`历史`,link:`hottest`,sort_type:0}}[o],f=`掘金${c}${d.title}最热`,p=`https://juejin.im/${l}?sort=${d.link}`,m=`https://api.juejin.cn/recommend_api/v1/article/recommend_all_feed`,h={cursor:`0`,id_type:2,limit:20,sort_type:d.sort_type};l!==`recommended`&&(m=`https://api.juejin.cn/recommend_api/v1/article/recommend_cate_feed`,h.cate_id=s);let g=await e(m,{method:`POST`,body:h}),_=g.data;return(a===`all`||a===`devops`||a===`product`||a===`design`)&&(_=g.data.filter(e=>e.item_type===2).map(e=>e.item_info)),{title:f,link:p,item:await r(n(_))}}export{i as route};