UNPKG

rsshub

Version:
36 lines (35 loc) 1.02 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { load } from "cheerio"; //#region lib/routes/ghisler/whatsnew.ts const route = { path: "/whatsnew", categories: ["program-update"], example: "/ghisler/whatsnew", name: "What's New", maintainers: ["nczitzk"], handler }; async function handler() { const currentUrl = `http://ghisler.com/whatsnew.htm`; const response = await rofetch(currentUrl); const $ = load(response.replaceAll("<h3 align=\"left\">", "</content><content><h3 align=\"left\">")); const items = $("content").toArray().map((item) => { const $item = $(item); const title = $item.find("h3").text().replaceAll(/\s+/g, " "); return { link: currentUrl, guid: `${currentUrl}#${title}`, title, description: $item.find("p").html(), pubDate: parseDate($item.find("b").text().split(":", 1)[0]) }; }); return { title: $("title").text(), link: currentUrl, item: items }; } //#endregion export { route };