UNPKG

rsshub

Version:
66 lines (63 loc) 2.38 kB
import "./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 got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/2023game/index.ts const route = { path: "/:category?/:tab?", categories: ["game"], example: "/2023game/sgame/topicList", parameters: { category: "分类,见下表", tab: "标签, 所有:all;最新:topicList;热门:jhcpb" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "游戏星辰", maintainers: ["xzzpig"], handler, url: "www.2023game.com/", description: `分类 | PS4游戏 | switch游戏 | 3DS游戏 | PSV游戏 | Xbox360 | PS3游戏 | 世嘉MD/SS | PSP游戏 | PC周边 | 怀旧掌机 | 怀旧主机 | PS4教程 | PS4金手指 | switch金手指 | switch教程 | switch补丁 | switch主题 | switch存档 | | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | | ps4 | sgame | 3ds | psv | jiaocheng | ps3yx | zhuji.md | zhangji.psp | pcgame | zhangji | zhuji | ps4.psjc | ps41.ps4pkg | nsaita.cundang | nsaita.pojie | nsaita.buding | nsaita.zhutie | nsaita.zhuti |` }; async function handler(ctx) { const category = (ctx.req.param("category") ?? "sgame").replaceAll(".", "/"); const tab = ctx.req.param("tab") ?? "all"; const currentUrl = `https://www.2023game.com/${category}/`; const $ = load((await got_default(currentUrl)).data); let selector = `.news`; if (tab !== "all") selector = `#${tab} > ${selector}`; const items = $(selector).toArray().map((item) => { const $item = $(item); const href = $item.find("a").attr("href"); return { title: $item.text().trim(), guid: `2023game:${href}`, link: href, pubDate: parseDate($item.find(".time_box").text().trim()), description: $item.html() ?? "" }; }); return { title: $("title").text(), link: currentUrl, allowEmpty: true, image: "https://www.2023game.com/resources/img/logo.png", item: items }; } //#endregion export { route };