rsshub
Version:
Make RSS Great Again!
52 lines (50 loc) • 1.74 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import "./config-MQ-7ebJ_.mjs";
import { t as ViewType } from "./types-gOySfSXJ.mjs";
import "./logger-C4avouvV.mjs";
import "./ofetch-DKl_Ma9g.mjs";
import { t as parseDate } from "./parse-date-r5WDWHno.mjs";
import "./helpers-Bo4JQYdN.mjs";
import { t as got_default } from "./got-CO-ndVl2.mjs";
import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime";
import { renderToString } from "hono/jsx/dom/server";
import { raw } from "hono/html";
//#region lib/routes/cngal/weekly.tsx
const route = {
path: "/weekly",
categories: ["anime"],
view: ViewType.Articles,
example: "/cngal/weekly",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["www.cngal.org/", "www.cngal.org/weeklynews"] }],
name: "每周速报",
maintainers: ["kmod-midori"],
handler,
url: "www.cngal.org/"
};
async function handler() {
return {
title: "CnGal - 每周速报",
link: "https://www.cngal.org/weeklynews",
item: (await got_default("https://api.cngal.org/api/news/GetWeeklyNewsOverview")).data.map((item) => ({
title: item.name,
description: renderDescription(item),
pubDate: parseDate(item.lastEditTime),
link: `https://www.cngal.org/articles/index/${item.id}`
}))
};
}
const renderDescription = (item) => {
const intro = item.briefIntroduction ? item.briefIntroduction.trim().replaceAll("\n", "<br>") : "";
return renderToString(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", { children: intro ? raw(intro) : null }), item.mainImage ? /* @__PURE__ */ jsx("img", { src: item.mainImage }) : null] }));
};
//#endregion
export { route };