UNPKG

rsshub

Version:
49 lines (47 loc) 1.39 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { load } from "cheerio"; //#region lib/routes/react/blog.ts const handler = async () => { const $ = load(await ofetch_default("https://react.dev/blog")); return { title: "React Blog", link: "https://react.dev/blog", language: "en-US", item: await Promise.all($("a[href^=\"/blog/\"]").toArray().slice(0, 20).map((item) => { const link = `https://react.dev${item.attribs.href}`; return cache_default.tryGet(`react:blog:${link}`, async () => { const $$1 = load(await ofetch_default(link)); return { title: $$1("h1").first().text().trim(), link, description: $$1("article div:nth-child(2)").html() ?? "", pubDate: parseDate($$1("p.whitespace-pre-wrap").first().text().split(/\s+by/)[0]) }; }); })) }; }; const route = { path: "/blog", name: "Blog", categories: ["blog"], maintainers: ["equt"], example: "/react/blog", features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, handler }; //#endregion export { route };