rsshub
Version:
Make RSS Great Again!
37 lines (36 loc) • 1.07 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { load } from "cheerio";
//#region lib/routes/chocolatey/software.ts
const route = {
path: "/software/:name?",
categories: ["program-update"],
example: "/chocolatey/software/GoogleChrome",
parameters: { name: "Software name" },
name: "Software Update",
maintainers: ["woodgear"],
handler
};
async function handler(ctx) {
const { name } = ctx.req.param();
const link = `https://community.chocolatey.org/packages/${name}`;
const $ = load(await rofetch(link));
return {
title: name,
link,
item: $("#versionhistory table tbody tr").toArray().map((row) => {
const $tds = $(row).find("td");
const $version = $tds.filter(".version");
const href = $version.find("a").attr("href");
const time = $tds.eq(3).text();
return {
title: $version.text().trim(),
link: href ? new URL(href, link).href : link,
description: `update_time: ${time}`,
pubDate: parseDate(time)
};
})
};
}
//#endregion
export { route };