UNPKG

rsshub

Version:
80 lines (78 loc) 1.85 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import "./cache-SV6W5EPy.mjs"; import "./timezone-CA9Huotp.mjs"; import { i as parseArticleList, n as getArticleList, r as mdTableBuilder, t as getArticle } from "./utils-DUHCxQwU.mjs"; //#region lib/routes/gamersky/review.ts const idNameMap = [ { type: "pc", name: "单机", nodeId: "20465" }, { type: "tv", name: "电视", nodeId: "20466" }, { type: "indie", name: "独立游戏", nodeId: "20922" }, { type: "web", name: "网游", nodeId: "20916" }, { type: "mobile", name: "手游", nodeId: "20917" }, { type: "all", name: "全部评测", nodeId: "20915" } ]; const route = { path: "/review/:type?", categories: ["game"], example: "/gamersky/review/pc", parameters: { type: "评测类型,可选值为 `pc`、`tv`、`indie`、`web`、`mobile`、`all`,默认为 `pc`" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www.gamersky.com/review"], target: "/review" }], name: "评测", maintainers: ["yy4382"], description: mdTableBuilder(idNameMap), handler }; async function handler(ctx) { const type = ctx.req.param("type") ?? "pc"; const idName = idNameMap.find((item) => item.type === type); if (!idName) throw new Error(`Invalid type: ${type}`); const list = parseArticleList(await getArticleList(idName.nodeId)); const fullTextList = await Promise.all(list.map((item) => getArticle(item))); return { title: `${idName.name} - 游民星空评测`, link: "https://www.gamersky.com/review", item: fullTextList }; } //#endregion export { route };