import{t as e}from"./parse-date-BdYTmLpo.mjs";import{t}from"./got-BBDj7u1e.mjs";import{load as n}from"cheerio";const r={path:`/:creators`,categories:[`multimedia`],example:`/xhamster/faustina-pierre`,parameters:{creators:"Creator slug from the URL (e.g. `faustina-pierre`)"},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1,nsfw:!0},radar:[{source:[`xhamster.com/creators/:creators`,`xhamster.com/creators/:creators/newest`],target:`/:creators`}],name:`Newest Videos by Creator`,maintainers:[`eve2ptp`],handler:s,url:`xhamster.com/faustina-pierre/newest`};function i(e){let t=e.match(/window\.initials\s*=\s*([\s\S]*?);?$/);if(!t)throw Error(`initials not found`);return JSON.parse(t[1])}function a(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`:`${n}:${String(r).padStart(2,`0`)}`}function o(e){let t=e.imageURL??e.thumbURL,n=e.duration?a(e.duration):``,r=e.views===void 0?``:e.views.toLocaleString(),i=e.isUHD?`<span>4K</span>`:``,o=``;return i&&(o+=i),n&&(o+=`${o?` · `:``}<strong>Duration:</strong> ${n}`),r&&(o+=`${o?` · `:``}<strong>Views:</strong> ${r}`),`
        <img src="${t}" alt="${e.title}" style="max-width:100%" />
        <p>${o}</p>
    `.trim()}async function s(r){let{creators:a}=r.req.param(),s=`https://xhamster.com/creators/${encodeURIComponent(a)}/newest`,c=n((await t(s)).data)(`#initials-script`).text();if(!c)throw Error(`Could not locate initials script on page`);let l;try{l=i(c)}catch{throw Error(`Failed to parse page data`)}let u=l.infoComponent?.pornstarTop?.name??a,d=(l.trendingVideoSectionComponent?.videoListProps?.videoThumbProps??[]).map(t=>({title:`${t.title}${t.isUHD?` [4K]`:``}`,link:t.pageURL,pubDate:t.created?e(t.created*1e3):void 0,author:u,description:o(t),media:{content:{url:t.trailerURL??t.pageURL,type:`video/mp4`,...t.duration&&{duration:t.duration}},thumbnail:{url:t.imageURL??t.thumbURL}}}));return{title:`${u} - newest videos on xHamster`,link:s,description:`Latest videos from ${u} on xHamster`,item:d}}export{r as route};