rsshub
Version:
Make RSS Great Again!
63 lines (61 loc) • 1.94 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./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 art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
//#region lib/routes/gofans/index.ts
init_esm_shims();
const route = {
path: "/:kind?",
categories: ["program-update"],
example: "/gofans",
parameters: { kind: "Platform, either `macos` or `ios`, empty means both (default)" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "最新限免 / 促销应用",
maintainers: ["HenryQW"],
handler
};
async function handler(ctx) {
const { kind = "" } = ctx.req.param();
const baseUrl = "https://gofans.cn";
const { data: response } = await got_default("https://api.gofans.cn/v1/web/app_records", {
headers: { origin: baseUrl },
searchParams: {
limit: 20,
kind: kind && (kind === "macos" ? 1 : 2),
page: 1
}
});
return {
title: "最新限免 / 促销应用",
link: baseUrl,
description: "GoFans:最新限免 / 促销应用",
item: response.data.map((item) => ({
title: `「${item.price === "0.00" ? "免费" : "降价"}」-「${item.kind === 1 ? "macOS" : "iOS"}」${item.name}`,
description: art(path.join(__dirname, "templates/description-d95c3846.art"), {
icon: item.icon,
originalPrice: item.original_price,
price: item.price,
kind: item.kind,
description: item.description.replaceAll("\n", "<br>")
}),
pubDate: parseDate(item.updated_at, "X"),
link: new URL(`/app/${item.uuid}`, baseUrl).href,
category: item.primary_genre_name
}))
};
}
//#endregion
export { route };