rsshub
Version:
Make RSS Great Again!
54 lines (52 loc) • 1.71 kB
JavaScript
import "./config-C37vj7VH.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./proxy-Db7uGcYb.mjs";
import "./puppeteer-DGmvuGvT.mjs";
import { n as puppeteerGet, t as baseURL } from "./utils-BxyTqrYr.mjs";
import { load } from "cheerio";
//#region lib/routes/alternativeto/platform.ts
const route = {
path: "/platform/:name/:routeParams?",
categories: ["programming"],
example: "/alternativeto/platform/firefox",
parameters: {
name: "Platform name",
routeParams: "Filters of software type"
},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["www.alternativeto.net/platform/:name"],
target: "/platform/:name"
}],
name: "Platform Software",
maintainers: ["JimenezLi"],
handler,
description: `> routeParms can be copied from original site URL, example: \`/alternativeto/platform/firefox/license=free\``
};
async function handler(ctx) {
const link = `https://alternativeto.net/platform/${ctx.req.param("name")}/?${new URLSearchParams(ctx.req.param("routeParams")).toString()}`;
const $ = load(await puppeteerGet(link, cache_default));
return {
title: $(".Heading_h1___Cf5Y").text().trim(),
description: $(".intro-text").text().trim(),
link,
item: $(".AppListItem_appInfo__h9cWP").toArray().map((element) => {
const item = $(element);
return {
title: item.find(".Heading_h2___LwQD").text().trim(),
link: `${baseURL}${item.find(".Heading_h2___LwQD a").attr("href")}`,
description: item.find(".AppListItem_description__wtODK").text().trim()
};
})
};
}
//#endregion
export { route };