rsshub
Version:
Make RSS Great Again!
56 lines (54 loc) • 1.85 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./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 art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
import { load } from "cheerio";
//#region lib/routes/nintendo/direct.ts
init_esm_shims();
const route = {
path: "/direct",
categories: ["game"],
example: "/nintendo/direct",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["nintendo.com/nintendo-direct/archive", "nintendo.com/"] }],
name: "Nintendo Direct",
maintainers: ["HFO4"],
handler,
url: "nintendo.com/nintendo-direct/archive"
};
async function handler() {
const data = (await got_default("https://www.nintendo.com/nintendo-direct/archive/")).data;
const $ = load(data);
const nextData = JSON.parse($("script#__NEXT_DATA__").text());
delete nextData.props.pageProps.initialApolloState.ROOT_QUERY;
return {
title: "Nintendo Direct(任天堂直面会)",
link: "https://www.nintendo.com/nintendo-direct/archive/",
description: "最新的任天堂直面会日程信息",
item: Object.values(nextData.props.pageProps.initialApolloState).map((item) => ({
title: item.name,
pubDate: parseDate(item.startDate),
link: `https://www.nintendo.com/nintendo-direct/${item.slug}/`,
description: art(path.join(__dirname, "templates/direct-3fe22cf9.art"), {
publicId: item.thumbnail.publicId,
content: item.description.json.content
})
}))
};
}
//#endregion
export { route };