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"./parse-date-BdYTmLpo.mjs";import{t as i}from"./timezone-keeL11Io.mjs";import a from"node:crypto";const o=t.qingting.id??``,s={path:`/podcast/:id`,categories:[`multimedia`],example:`/qingting/podcast/293411`,parameters:{id:`专辑id, 可在专辑页 URL 中找到`},features:{supportPodcast:!0,requireConfig:[{name:`QINGTING_ID`,optional:!0,description:`用户id， 部分专辑需要会员身份，用户id可以通过从网页端登录蜻蜓fm后使用开发者工具，在控制台中运行JSON.parse(localStorage.getItem("user")).qingting_id获取`}]},radar:[{source:[`qingting.fm/channels/:id`]}],name:`播客`,maintainers:[`RookieZoe`,`huyyi`,`pseudoyu`],handler:l,description:`获取的播放 URL 有效期只有 1 天，需要开启播客 APP 的自动下载功能。`};function c(e,t){let n=`/audiostream/redirect/${e}/${t}?access_token=&device_id=MOBILESITE&qingting_id=${o}&t=${Date.now()}`;return`https://audio.qingting.fm${n}&sign=${a.createHmac(`md5`,`fpMn12&38f_2e`).update(n).digest(`hex`).toString()}`}async function l(t){let a=t.req.param(`id`),s=Number(t.req.query(`limit`))||30,l=await e(`https://i.qingting.fm/capi/v3/channel/${a}`,{headers:{Referer:`https://www.qingting.fm/`}}),u=l.data.title,d=l.data.thumbs[`400_thumb`],f=l.data.podcasters.map(e=>e.nick_name).join(`,`),p=l.data.description,{data:{programs:m}}=await e(`https://i.qingting.fm/capi/channel/${a}/programs/${l.data.v}?curpage=1&pagesize=${s}&order=asc`,{headers:{Referer:`https://www.qingting.fm/`}}),{data:h}=await e(`https://i.qingting.fm/capi/v3/channel/${a}?user_id=${o}`),g=h.purchase?.item_type!==0,_=h.user_relevance?.sale_status===`paid`,v=await Promise.all(m.map(async t=>{let o=await n.tryGet(`qingting:podcast:${a}:${t.id}`,async()=>{let n=`https://www.qingting.fm/channels/${a}/programs/${t.id}/`,o=await e(n,{headers:{Referer:`https://www.qingting.fm/`}}),s=JSON.parse(o.match(/},"program":(.*?),"plist":/)[1]);return{title:t.title,link:n,itunes_item_image:t.cover,itunes_duration:t.duration,pubDate:i(r(t.update_time),8),description:s.richtext}});return(!g||_||t.isfree)&&(o.enclosure_url=c(a,t.id),o.enclosure_type=`audio/x-m4a`),o}));return{title:`${u} - 蜻蜓FM`,description:p,itunes_author:f,image:d,link:`https://www.qingting.fm/channels/${a}`,item:v}}export{s as route};