import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{a as n,i as r,n as i,t as a}from"./util-C1azhJmz.mjs";import{load as o}from"cheerio";const s=(e,t)=>{let n=e?.user?.data,r=n?t.find(e=>e.type===n.type&&e.id===n.id):void 0;return r?[{name:r.attributes?.nickname,url:r.id?new URL(`users/${r.id}`,a).href:void 0,avatar:r.thumb?new URL(r.thumb,i).href:void 0}]:void 0},c=(e,t,n,r,i)=>{let a=n.find(e=>e.id===t.media?.data?.id)?.attributes,o,s;if(e[`speech-path`]?(o=new URL(`uploads/audio/${e[`speech-path`]}`,`https://alioss.gcores.com`).href,s=`audio/${o?.split(/\./).pop()}`):a&&a.audio&&(o=a.audio,s=`audio/${o?.split(/\./).pop()}`),!o)return{};let c=e.duration?Number(e.duration):0;return{enclosure_url:o,enclosure_type:s,enclosure_title:i,enclosure_length:c,itunes_duration:c,itunes_item_image:r}},l=(e,t,a,o)=>n({images:e.cover?[{src:new URL(e.cover,i).href,alt:t}]:void 0,audios:o?.startsWith(`audio`)&&a?[{src:a,type:o}]:void 0,intro:e.desc||e.excerpt,description:e.content?r(JSON.parse(e.content)):void 0}),u=async n=>{let{id:r}=n.req.param(),u=Number.parseInt(n.req.query(`limit`)??`30`,10),d=new URL(`users/${r}/content?tab=radios`,a).href,f=new URL(`gapi/v1/users/${r}/radios`,a).href,p=await e(f,{query:{"page[limit]":u,sort:`-published-at`,include:`user,media,albums`}}),m=p.data,h=o(await e(d)),g=h(`html`).attr(`lang`)??`zh-CN`,_=p.included||[],v=m.map(e=>{let n=e.attributes,r=e.relationships,o=n.title,u=n[`published-at`],d=new URL(`radios/${e.id}`,a).href,f=n.cover??n.thumb?new URL(n.cover??n.thumb,i).href:void 0,p=s(r,_),m=c(n,r,_,f,o),v=l(n,o,m.enclosure_url,m.enclosure_type),y=(r?.albums?.data||[]).map(e=>_.find(t=>t.type===e.type&&t.id===e.id)?.attributes?.title).filter(Boolean);return{title:o??h(v).text(),pubDate:u?t(u):void 0,link:d,author:p,category:y.length>0?y:void 0,guid:`gcores-${e.id}`,id:`gcores-${e.id}`,image:f,banner:f,updated:u?t(u):void 0,language:g,description:v,content:{html:v,text:v},...m}});return{title:h(`title`).text(),description:h(`meta[name="description"]`).attr(`content`),link:d,item:v,allowEmpty:!0,author:h(`title`).text().split(/\|/).pop()?.trim(),language:g,id:h(`meta[property="og:url"]`).attr(`content`)}},d={path:`/users/:id/radios`,name:`用户播客`,url:`www.gcores.com`,maintainers:[`DzmingLi`],handler:u,example:`/gcores/users/31418/radios`,parameters:{id:{description:`用户 ID，可在用户主页 URL 中找到`}},description:"::: tip\n若订阅用户 [这样重这样轻](https://www.gcores.com/users/31418) 发布的播客，网址为 `https://www.gcores.com/users/31418`，请截取 `https://www.gcores.com/users/` 之后的部分 `31418` 作为 `id` 参数填入，此时目标路由为 [`/gcores/users/31418/radios`](https://rsshub.app/gcores/users/31418/radios)。\n:::\n",categories:[`game`],features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportRadar:!0,supportBT:!1,supportPodcast:!0,supportScihub:!1},radar:[{source:[`www.gcores.com/users/:id/content`,`www.gcores.com/users/:id`],target:`/users/:id/radios`}],view:4};export{u as handler,d as route};