rsshub
Version:
Make RSS Great Again!
34 lines (33 loc) • 1.08 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/python/downloads.ts
const route = {
path: "/:pre?",
categories: ["program-update"],
example: "/python",
parameters: { pre: "填入 `pre` 以包含预发布版本,默认只含正式版本" },
name: "版本发布",
maintainers: ["trim21"],
handler
};
async function handler(ctx) {
const { pre: includePreRelease } = ctx.req.param();
const $ = load(await rofetch("https://www.python.org/downloads"));
return {
title: "cpython",
link: "https://www.python.org/",
item: $(".list-row-container.menu li").toArray().map((el) => {
const $item = $(el);
const title = $item.find("span.release-number").text();
return {
title,
description: title,
link: $item.find(".release-enhancements a").attr("href"),
pubDate: parseDate($item.find(".release-date").text())
};
}).filter(({ title }) => title && (includePreRelease || !title.includes("rc")))
};
}
//#endregion
export { route };