rsshub
Version:
Make RSS Great Again!
49 lines (47 loc) • 1.42 kB
JavaScript
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/nextjs/blog.ts
const handler = async () => {
const $ = load(await ofetch_default("https://nextjs.org/blog"));
return {
title: "Next.js Blog",
link: "https://nextjs.org/blog",
language: "en-US",
item: await Promise.all($("article").toArray().slice(0, 20).map((item) => {
const link = `https://nextjs.org${load(item)("a[href^=\"/blog\"]").attr("href")}`;
return cache_default.tryGet(`nextjs:blog:${link}`, async () => {
const $$1 = load(await ofetch_default(link));
return {
title: $$1("h1").first().text().trim(),
link,
description: $$1("div.prose").html() ?? "",
pubDate: parseDate($$1("p[data-version=\"v1\"]").first().text().replace(/st|nd|rd|th/, ""))
};
});
}))
};
};
const route = {
path: "/blog",
name: "Blog",
categories: ["program-update"],
maintainers: ["equt"],
example: "/nextjs/blog",
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
handler
};
//#endregion
export { route };