import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./got-BBDj7u1e.mjs";import{load as n}from"cheerio";const r={path:`/replies/:uid`,categories:[`social-media`],example:`/douban/replies/xiaoyaxiaoya`,parameters:{uid:`用户id，可在用户日记页 URL 中找到`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`日记最新回应`,maintainers:[`nczitzk`],handler:i};async function i(r){let i=`https://www.douban.com/people/${r.req.param(`uid`)}/notes`,a=n((await t({method:`get`,url:i})).data),o=a(`div.recent-replies-mod ul.comment-list li`).toArray().map(e=>{e=a(e);let t=e.find(`p`),n=t.find(`a`).attr(`href`).match(/%2Fnote%2F(.*?)%2F%23(.*?)&type=note/),r=n[1],i=n[2];return t.remove(),{link:`https://www.douban.com/note/${r}/#${i}`}}),s=await Promise.all(o.map(n=>e.tryGet(n.link,async()=>{let e=await t({method:`get`,url:n.link}),r=JSON.parse(e.data.match(/'comments':(.*)}],/)[1]+`}]`);for(let e of r)if(e.id===n.link.split(`#`)[1])return{link:n.link,title:`${e.author.name} 于 ${e.create_time} 的回应`,pubDate:new Date(e.create_time+` GMT+8`).toUTCString(),description:e.text,author:e.author.name};else e.replies.length>0&&r.push(...e.replies)})));return{title:a(`title`).text()+` - 最新回应`,link:i,item:s}}export{r as route};