UNPKG

rsshub

Version:
63 lines (61 loc) 1.89 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 { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { t as appsUrl } from "./utils-CBTVNQEo.mjs"; import { load } from "cheerio"; //#region lib/routes/qoo-app/apps/card.ts const route = { path: "/apps/:lang?/card/:id", categories: ["anime"], example: "/qoo-app/apps/en/card/7675", parameters: { lang: "Language, see the table above, empty means `中文`", id: "Game ID, can be found in URL" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "Game Store - Cards", maintainers: ["TonyRL"], handler }; async function handler(ctx) { const { id, lang = "" } = ctx.req.param(); const link = `${appsUrl}${lang ? `/${lang}` : ""}/app-card/${id}`; const { data: response } = await got_default(link); const $ = load(response); const items = $(".qoo-post-item").toArray().map((item) => { item = $(item); const name = item.find(".qoo-clearfix .name a"); const author = name.eq(0).text(); const pubDate = timezone(parseDate(item.find("time").text(), "YYYY-MM-DD HH:mm:ss"), 8); item.find("a.icon, .qoo-clearfix, footer, article.qoo-comment-panel, div.slot").remove(); item.find(".img-list").attr("data-target", ""); return { title: `${author}${name.eq(1).text()}`, description: item.html(), pubDate, author, guid: `qoo-app:apps:card:7675:${item.attr("data-id")}` }; }); return { title: $("head title").text(), link, language: $("html").attr("lang"), item: items }; } //#endregion export { route };