rsshub
Version:
Make RSS Great Again!
44 lines (43 loc) • 1.22 kB
JavaScript
import { t as rofetch } from "./ofetch-C3ts-Hud.mjs";
import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs";
import { t as cache_default } from "./cache-BkqOokyU.mjs";
import { load } from "cheerio";
//#region lib/routes/react/blog.ts
const handler = async () => {
const $ = load(await rofetch("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 $ = load(await rofetch(link));
return {
title: $("h1").first().text(),
link,
description: $("article div:nth-child(2)").html(),
pubDate: parseDate($("p.whitespace-pre-wrap").first().text().split(/\s+by/, 1)[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 };