rsshub
Version:
Make RSS Great Again!
71 lines (70 loc) • 2.58 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs";
import { t as namespace } from "./namespace-CwV8KdhH.mjs";
import { jsx, jsxs } from "hono/jsx/jsx-runtime";
import { renderToString } from "hono/jsx/dom/server";
//#region lib/routes/yinxubwg/exhibition.tsx
const route = {
path: "/exhibitionIndex/:type",
categories: ["travel"],
example: "/yinxubwg/exhibitionIndex/2",
parameters: { type: "Exhibition type. Supported values: `1` (Permanent Exhibition), `2` (Temporary Exhibition), `3` (Past Exhibitions)." },
name: "Exhibition Information",
maintainers: ["magazian"],
radar: [{
source: ["www.yinxubwg.cn/yxgw/exhibitionIndex"],
target: "/exhibitionIndex/:type"
}],
handler: async (ctx) => {
const typeParam = ctx.req.param("type");
const exhibitionType = Number(typeParam);
const baseUrl = "https://www.yinxubwg.cn";
const apiBaseUrl = "https://guc.yinxubwg.cn";
const museumName = namespace.zh?.name || namespace.name;
const feedTitle = {
1: "常设展览",
2: "临时展览",
3: "展览回眸"
}[exhibitionType];
const items = ((await rofetch(`${apiBaseUrl}/gwebapi/exhibition/list`, { query: {
p: "w",
exhibition_type: exhibitionType,
language: 1,
page: 1,
limit: 10
} })).data?.list ?? []).map((item) => {
const link = `${baseUrl}/yxgw/exhibitionIndex/exhibitionDetail?exhibitionId=${item.exhibition_id}`;
const imgUrl = item.list_img;
const startDate = item.start_date_format;
const endDate = item.end_date_format;
const location = item.place;
const description = renderToString(/* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsx("img", { src: imgUrl }),
/* @__PURE__ */ jsx("br", {}),
/* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("b", { children: "地点:" }), location || "参考详情"] }),
/* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("b", { children: "开展:" }), startDate || "未定/常设"] }),
/* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("b", { children: "闭展:" }), endDate || "未定/常设"] })
] }));
return {
title: item.exhibition_name,
link,
pubDate: startDate ? parseDate(startDate) : void 0,
description,
_extra: {
museumName,
location,
startDate,
endDate
}
};
});
return {
title: `${museumName} - ${feedTitle}`,
link: `${baseUrl}/yxgw/exhibitionIndex/exhibitionList?type=${exhibitionType}`,
language: "zh-CN",
item: items
};
}
};
//#endregion
export { route };