import{t as e}from"./config-BYRrjYC5.mjs";import{t}from"./cache-DUthuMSu.mjs";import{t as n}from"./got-BBDj7u1e.mjs";import{t as r}from"./config-not-found-B9AOp828.mjs";import{n as i,t as a}from"./readable-social-CL7r3QmK.mjs";import{t as o}from"./utils-BnXyH6NR.mjs";import s from"node:querystring";const c={path:`/group/:gid/:gname?/:routeParams?`,categories:[`social-media`],example:`/weibo/group/4541216424989965`,parameters:{gid:"分组id, 在网页版分组地址栏末尾`?gid=`处获取",gname:"分组显示名称; 默认为: `微博分组`",routeParams:`额外参数；请参阅上面的说明和表格`},features:{requireConfig:[{name:`WEIBO_COOKIES`,optional:!0,description:``}],requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`自定义分组`,maintainers:[`monologconnor`,`Rongronggg9`],handler:l,description:`::: warning
  由于微博官方未提供自定义分组相关 api, 此方案必须使用用户\`Cookie\`进行抓取

  因微博 cookies 的过期与更新方案未经验证，部署一次 Cookie 的有效时长未知

  微博用户 Cookie 的配置可参照部署文档
:::`};async function l(c){if(!e.weibo.cookies)throw new r(`Weibo Group Timeline is not available due to the absense of [Weibo Cookies]. Check <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config tutorial</a>`);let l=c.req.param(`gid`),u=c.req.param(`gname`)||`微博分组`,d=`1`,f=`0`,p=`0`;if(c.req.param(`routeParams`))if(c.req.param(`routeParams`)===`1`||c.req.param(`routeParams`)===`0`)d=c.req.param(`routeParams`);else{let e=s.parse(c.req.param(`routeParams`));d=a(void 0,i(e.displayVideo),!0)?`1`:`0`,f=a(void 0,i(e.displayArticle),!1)?`1`:`0`,p=a(void 0,i(e.displayComments),!1)?`1`:`0`}let m=await t.tryGet(`weibo:group:index:${l}`,async()=>(await n({method:`get`,url:`https://m.weibo.cn/feed/group?gid=${l}`,headers:{Referer:`https://m.weibo.cn/`,Cookie:e.weibo.cookies,...o.apiHeaders}})).data.data,e.cache.routeExpire,!1),h=await Promise.all(m.statuses.map(async e=>{let n=e.retweeted_status;if(n&&n.isLongText){let r=await t.tryGet(`weibo:retweeted:${n.user.id}:${n.bid}`,()=>o.getShowData(n.user.id,n.bid));r!==void 0&&r.text&&(e.retweeted_status.text=r.text)}let r=o.formatExtended(c,e),i=r.description;return d===`1`&&(i=e.retweeted_status?o.formatVideo(i,e.retweeted_status):o.formatVideo(i,e)),p===`1`&&(i=await o.formatComments(c,i,e,`0`)),f===`1`&&(i=await(e.retweeted_status?o.formatArticle(c,i,e.retweeted_status):o.formatArticle(c,i,e))),{...r,description:i}}));return o.sinaimgTvax({title:u,link:`https://weibo.com/mygroups?gid=${l}`,description:`微博自定义分组`,item:h})}export{c as route};