import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./cache-DUthuMSu.mjs";import{t as n}from"./parse-date-BdYTmLpo.mjs";import{t as r}from"./description-5VdSuN_K.mjs";import{load as i}from"cheerio";const a={name:`IEEE Author Articles`,maintainers:[`Derekmini`],categories:[`journal`],path:`/author/:aid/:sortType`,parameters:{aid:`Author ID`,sortType:`Sort Type of papers`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!0},example:`/ieee/author/37264968900/newest`,handler:o};async function o(a){let{aid:o,sortType:s}=a.req.param(),c=a.req.query(`limit`)||10,l=`https://ieeexplore.ieee.org`,u=(await e(`${l}/rest/author/${o}`))[0],d=`${u.preferredName} on IEEE Xplore`,f=`${l}/author/${o}`,p=u.bioParagraphs.join(` `),m=`${l}${u.photoUrl}`,h=(await e(`${l}/rest/search`,{method:`POST`,body:{rowsPerPage:c,searchWithin:[`"Author Ids": ${o}`],sortType:s}})).records.map(e=>({title:e.articleTitle,link:e.htmlLink,doi:e.doi,authors:`authors`in e?e.authors.map(e=>e.preferredName).join(`; `):`Do not have author`,abstract:`abstract`in e?e.abstract:``}));return{title:d,link:f,description:p,item:await Promise.all(h.map(a=>t.tryGet(a.link,async()=>{if(a.abstract!==``){let t=i(await e(`${l}${a.link}`,{parseResponse:e=>e})).html().match(/metadata=(.*);/),r=t?JSON.parse(t[1]):null;a.pubDate=r?.insertDate?n(r.insertDate):void 0,a.abstract=i(r?.abstract||``).text()}return{...a,description:r(a)}}))),image:m}}export{a as route};