UNPKG

rsshub

Version:
60 lines (58 loc) 1.9 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import * as cheerio from "cheerio"; //#region lib/routes/f-droid/apprelease.ts const route = { path: "/apprelease/:app", categories: ["program-update"], example: "/f-droid/apprelease/com.termux", parameters: { app: "App's package name" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["f-droid.org/en/packages/:app/"] }], name: "App Update", maintainers: ["garywill"], handler }; async function handler(ctx) { const { app } = ctx.req.param(); const { data: response } = await got_default(`https://f-droid.org/en/packages/${app}/`); const $ = cheerio.load(response); const appName = $(".package-title").find("h3").text().trim(); const items = $(".package-versions-list .package-version").toArray().map((item) => { const $item = $(item); const a = $item.find(".package-version-header a"); const version = a.eq(0).attr("name"); return { title: version, guid: a.eq(1).attr("name"), pubDate: parseDate($item.find(".package-version-header").text().split("Added on ")[1]), description: [ $item.find(".package-version-download").html(), $item.find(".package-version-requirement").html(), $item.find(".package-version-source").html() ].join("<br>"), link: `https://f-droid.org/en/packages/${app}/#${version}` }; }); return { title: `${appName} releases on F-Droid`, discription: $(".package-summary").text(), link: `https://f-droid.org/en/packages/${app}/`, item: items }; } //#endregion export { route };