rsshub
Version:
Make RSS Great Again!
52 lines (50 loc) • 1.57 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/houxu/events.ts
init_esm_shims();
const route = {
path: "/events",
categories: ["new-media"],
example: "/houxu/events",
radar: [{ source: ["houxu.app/events", "houxu.app/"] }],
name: "专栏",
maintainers: ["nczitzk"],
handler,
url: "houxu.app/events"
};
async function handler(ctx) {
const rootUrl = "https://houxu.app";
const apiUrl = `${rootUrl}/api/1/events?limit=${ctx.req.query("limit") ?? 50}`;
return {
title: "后续 - 专栏",
link: `${rootUrl}/events`,
item: (await got_default({
method: "get",
url: apiUrl
})).data.results.map((item) => ({
guid: `${rootUrl}/events/${item.id}#${item.last_thread.id}`,
title: item.title,
link: `${rootUrl}/events/${item.id}`,
author: item.creator.name,
category: item.tags,
pubDate: parseDate(item.update_at),
description: art(path.join(__dirname, "templates/events-e4c580c0.art"), {
title: item.title,
description: item.description,
linkTitle: item.last_thread.link_title,
content: item.last_thread.title.replaceAll("\r\n", "<br>"),
pubDate: item.update_at
})
}))
};
}
//#endregion
export { route };