UNPKG

rsshub

Version:
64 lines (62 loc) 2.13 kB
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 { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as art } from "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import path from "node:path"; import { load } from "cheerio"; //#region lib/routes/shcstheatre/programs.ts init_esm_shims(); const route = { path: "/programs", categories: ["shopping"], example: "/shcstheatre/programs", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www.shcstheatre.com/Program/programList.aspx"] }], name: "节目列表", maintainers: ["fuzy112"], handler, url: "www.shcstheatre.com/Program/programList.aspx" }; async function handler() { const url = "https://www.shcstheatre.com/Program/programList.aspx"; const $ = load((await got_default.get(url)).data); const items = await Promise.all($("#datarow .program-name a").map((_, elem) => { const link = new URL($(elem).attr("href"), url); return cache_default.tryGet(link.toString(), async () => { const id = link.searchParams.get("id"); const data = (await got_default.post("https://www.shcstheatre.com/webapi.ashx?op=GettblprogramCache", { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" }, form: { id } })).data.data.tblprogram[0]; return { title: data.SCS_WEB_BRIEFNAME, link: link.toString(), description: art(path.join(__dirname, "templates/description-f9f25b7f.art"), data), pubDate: timezone(parseDate(data.SJ_DATE_PC), 8) }; }); })); return { title: "上海文化广场 - 节目列表", link: url, image: $(".menu-logo img").attr("src"), item: items }; } //#endregion export { route };