UNPKG

rsshub

Version:
38 lines (37 loc) 1.19 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { n as parseRelativeDate } from "./parse-date-CjhZE69i.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { load } from "cheerio"; //#region lib/routes/zhishifenzi/depth.ts const route = { path: "/depth", categories: ["study"], example: "/zhishifenzi/depth", name: "depth", maintainers: ["y9c"], handler }; const base = "https://zhishifenzi.com"; async function handler() { const link = `${base}/depth/`; const $ = load(await rofetch(link)); const list = $("div.inner_depth_list > ul > li").toArray().map((elem) => { const $elem = $(elem); return { title: $elem.find("h5 > a").text(), pubDate: parseRelativeDate($elem.find("div.inner_depth_list_tags > p").first().text()), link: new URL($elem.find("h5 > a").attr("href"), base).href }; }); return { title: "知識分子 | 深度", description: "知識分子 | 科學 文明 智慧", link, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { item.description = load(await rofetch(item.link))(".main div.inner_content").html(); return item; }))) }; } //#endregion export { route };