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{a as i,t as a}from"./utils-DTti4uOY.mjs";const o={path:`/category/:caty/:img?`,categories:[`multimedia`],view:3,example:`/pornhub/category/popular-with-women`,parameters:{caty:`category, see [categories](https://www.pornhub.com/webmasters/categories)`,img:"show images, set to `img=1` to enable"},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1,nsfw:!0},name:`Category`,maintainers:[`nczitzk`],handler:s};async function s(o){let{caty:s,img:c}=o.req.param(),l=await t.tryGet(`pornhub:categories`,async()=>{let{data:e}=await r(`${a}/webmasters/categories`);return e.categories}),u=Number.isNaN(s)?l.find(e=>e.category===s)?.id:s,d=Number.isNaN(s)?s:l.find(e=>e.id===Number.parseInt(s)).category,f=await t.tryGet(`pornhub:category:${d}`,async()=>{let{data:e}=await r(`${a}/webmasters/search?category=${d}`);return e},e.cache.routeExpire,!1);if(f.code)throw Error(f.message);let p=c===`img=1`,m=f.videos.map(e=>({title:e.title,link:e.url,description:i({thumbs:e.thumbs},p),pubDate:n(e.publish_date),category:[...new Set([...e.tags.map(e=>e.tag_name),...e.categories.map(e=>e.category)])]}));return{title:`Pornhub - ${d}`,link:`${a}/video?c=${u}`,item:m}}export{o as route};