rsshub
Version:
Make RSS Great Again!
39 lines (38 loc) • 1.19 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { load } from "cheerio";
//#region lib/routes/onenotegem/release.ts
const route = {
path: "/release",
categories: ["program-update"],
example: "/onenotegem/release",
name: "Release History",
maintainers: ["nczitzk"],
handler
};
const rootUrl = "http://www.onenotegem.com";
const currentUrl = `${rootUrl}/a/release`;
async function handler() {
const $ = load(await rofetch(currentUrl));
const list = $(".paragraph ul li a").slice(0, 10).toArray().map((item) => {
const $item = $(item);
return {
title: $item.text(),
link: `${rootUrl}${$item.attr("href")}`
};
});
const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const title = load(await rofetch(item.link))("h1.wsite-content-title");
item.description = title.next().next().next().html();
item.pubDate = parseDate(title.next().text());
return item;
})));
return {
title: "OneNote Gem Addins Release History",
link: currentUrl,
item: items
};
}
//#endregion
export { route };