rsshub
Version:
Make RSS Great Again!
40 lines (39 loc) • 1.26 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { n as parseRelativeDate } from "./parse-date-3kcy2Eau.mjs";
import { t as cache_default } from "./cache-C1Y-9qDV.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 response = await rofetch(link);
const $ = load(response);
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 () => {
const detailResponse = await rofetch(item.link);
item.description = load(detailResponse)(".main div.inner_content").html();
return item;
})))
};
}
//#endregion
export { route };