import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./got-BBDj7u1e.mjs";import*as r from"cheerio";const i={path:`/news/:type`,categories:[`reading`],example:`/tongli/news/6`,parameters:{type:`分類，可以在“新聞”鏈接中找到`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`新聞`,maintainers:[`CokeMine`],handler:a};async function a(i){let{type:a}=i.req.param(),o=`https://www.tongli.com.tw/`,{data:s,url:c}=await n(`${o}TNews_List.aspx`,{searchParams:{Type:a,Page:1}}),l=r.load(s),u=l(`.news_list ul li`).toArray().map(e=>{e=l(e);let n=e.find(`.title a`);return{title:n.text(),link:n.attr(`href`).startsWith(`http`)?n.attr(`href`):o+n.attr(`href`),pubDate:t(e.find(`.date`).text(),`YYYY.MM.DD`)}}),d=await Promise.all(u.map(t=>e.tryGet(t.link,async()=>{let{data:e}=await n(t.link),i=r.load(e);return t.link.startsWith(`https://tonglinv.pixnet.net/`)?t.description=i(`.article-content-inner`).html():/^https?:\/\/blog\.xuite\.net\//.test(t.link)?t.description=i(`#content_all`).html():/TNews_View\.aspx/.test(t.link)?t.description=i(`#ContentPlaceHolder1_TNewsContent`).html():t.description=``,t})));return{title:l(`.entry_title .n1`).text(),link:c,item:d}}export{i as route};