rsshub
Version:
Make RSS Great Again!
46 lines (45 loc) • 1.28 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs";
import { t as cache_default } from "./cache-C1Y-9qDV.mjs";
import { load } from "cheerio";
//#region lib/routes/nextjs/blog.ts
const handler = async () => {
const data = await rofetch("https://nextjs.org/blog");
const $ = load(data);
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 data = await rofetch(link);
const $ = load(data);
return {
title: $("h1").text(),
link,
description: $("div.prose").html(),
pubDate: parseDate($("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 };