import{t as e}from"./parse-date-BdYTmLpo.mjs";import{t}from"./got-BBDj7u1e.mjs";import{n,r,t as i}from"./utils-CFajW61L.mjs";import{load as a}from"cheerio";const o={path:`/zhuanlan/:id`,categories:[`social-media`],example:`/zhihu/zhuanlan/googledevelopers`,parameters:{id:`专栏 id，可在专栏主页 URL 中找到`},features:{requireConfig:[{name:`ZHIHU_COOKIES`,description:``}],requirePuppeteer:!1,antiCrawler:!0,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`zhuanlan.zhihu.com/:id`]}],name:`专栏`,maintainers:[`DIYgod`],handler:s};async function s(o){let s=o.req.param(`id`),c=`https://zhuanlan.zhihu.com/${s}`;s.search(`c_`)===0&&(c=`https://www.zhihu.com/column/${s}`);let l=await i(c,`/api/v4/columns/${s}/items`),u=await t({method:`get`,url:`https://www.zhihu.com/api/v4/columns/${s}/items`,headers:{...l,Referer:`https://zhuanlan.zhihu.com/${s}`}}),d=await t({method:`get`,url:`https://www.zhihu.com/api/v4/columns/${s}/pinned-items/v2`,headers:{...n,...l,Referer:`https://zhuanlan.zhihu.com/${s}`}});u.data.data=[...u.data.data,...d.data.data];let f=a((await t(c,{headers:{...l,Referer:c}})).data),p=f(`.css-zyehvu`).text();return{description:f(`.css-1bnklpv`).text(),item:u.data.data.map(t=>{let n=``;t.content&&(n=r(t.content));let i,a,o,s;switch(t.type){case`answer`:i=t.question.title,o=t.question.author?t.question.author.name:``,a=`https://www.zhihu.com/question/${t.question.id}/answer/${t.id}`,s=e(t.created_time*1e3);break;case`article`:i=t.title,a=t.url,o=t.author.name,s=e(t.created*1e3);break;case`zvideo`:i=t.title,a=`https://www.zhihu.com/zvideo/${t.id}`,o=t.author.name,s=e(t.created_at*1e3),n=t.description?`${t.description} <br> <br> <a href="${a}">视频内容请跳转至原页面观看</a>`:`<a href="${a}">视频内容请跳转至原页面观看</a>`;break;default:throw Error(`Unknown type: ${t.type}`)}return{title:i,link:a,description:n,pubDate:s,author:o}}),title:`知乎专栏-${p}`,link:c}}export{o as route};