rsshub
Version:
Make RSS Great Again!
90 lines (88 loc) • 2.17 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./parse-date-BrP7mxXf.mjs";
import "./cache-Bo__VnGm.mjs";
import "./timezone-D8cuwzTY.mjs";
import { i as parseArticleList, n as getArticleList, r as mdTableBuilder, t as getArticle } from "./utils-B_j8FHmv.mjs";
//#region lib/routes/gamersky/ent.ts
const idNameMap = new Map([
["all", {
title: "热点图文",
suffix: "ent",
nodeId: "20107"
}],
["qw", {
title: "趣囧时间",
suffix: "ent/qw",
nodeId: "20113"
}],
["movie", {
title: "游民影院",
suffix: "wenku/movie",
nodeId: "20111"
}],
["discovery", {
title: "游观天下",
suffix: "ent/discovery",
nodeId: "20114"
}],
["wp", {
title: "壁纸图库",
suffix: "ent/wp",
nodeId: "20117"
}],
["wenku", {
title: "游民盘点",
suffix: "wenku",
nodeId: "20106"
}],
["xz", {
title: "游民福利",
suffix: "ent/xz",
nodeId: "20119"
}]
]);
const route = {
path: "/ent/:category?",
categories: ["game"],
example: "/gamersky/ent/xz",
parameters: { type: "分类类型,留空为 `all`" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: Object.entries(idNameMap).map(([type, { title, suffix }]) => ({
title,
source: [`www.gamersky.com/${suffix}`],
target: `/ent/${type}`
})),
name: "娱乐",
maintainers: ["LogicJake"],
description: mdTableBuilder(Object.entries(idNameMap).map(([type, { title, nodeId }]) => ({
type,
name: title,
nodeId
}))),
handler
};
async function handler(ctx) {
const category = ctx.req.param("category") ?? "all";
const idName = idNameMap.get(category);
if (!idName) throw new Error(`Invalid type: ${category}`);
const list = parseArticleList(await getArticleList(idName.nodeId));
const fullTextList = await Promise.all(list.map((item) => getArticle(item)));
return {
title: `${idName.title} - 游民娱乐`,
link: `https://www.gamersky.com/${idName.suffix}`,
item: fullTextList
};
}
//#endregion
export { route };