UNPKG

rsshub

Version:
49 lines (47 loc) 1.35 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import { t as ViewType } from "./types-D84BRIt4.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/yilinzazhi/index.ts const route = { path: "/", categories: ["reading"], view: ViewType.Articles, example: "/yilinzazhi", radar: [{ source: ["www.yilinzazhi.com"], target: "/" }], name: "文章列表", maintainers: ["g0ngjie"], handler, url: "www.yilinzazhi.com" }; async function handler() { const baseUrl = "https://www.yilinzazhi.com/"; const $ = load((await got_default(baseUrl)).data); const contents = $("section.content").find("li").toArray().map((target) => { const aTag = $(target).find("a"); return { title: aTag.text(), link: baseUrl + aTag.attr("href"), description: "" }; }); return { title: "意林杂志网", link: baseUrl, item: await Promise.all(contents.map((content) => cache_default.tryGet(content.link, async () => { content.description = load((await got_default(content.link)).data)(".maglistbox").html(); return content; }))) }; } //#endregion export { route };