UNPKG

rsshub

Version:
59 lines (57 loc) 2.26 kB
import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs"; import { t as got_default } from "./got-BTowW50G.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()), 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 };