rsshub
Version:
Make RSS Great Again!
52 lines (50 loc) • 1.59 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 { r as getSubPath } from "./common-utils-vrWQFAEk.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/zyshow/index.ts
init_esm_shims();
const route = {
path: "*",
name: "Unknown",
maintainers: [],
handler
};
async function handler(ctx) {
const currentUrl = `http://www.zyshow.net${getSubPath(ctx).replace(/\/$/, "")}/`;
const $ = load((await got_default({
method: "get",
url: currentUrl
})).data);
const items = $("table").last().find("tr td a img.icon-play").toArray().map((item) => {
item = $(item).parentsUntil("tbody");
const a = item.find("a[title]").first();
const guests = item.find("td").eq(2).text();
return {
title: a.text(),
link: `${currentUrl}v/${a.attr("href").split("/v/").pop()}`,
pubDate: parseDate(a.text().match(/(\d{8})$/)[1], "YYYYMMDD"),
description: art(path.join(__dirname, "templates/description-0a7565c6.art"), {
date: item.find("td").first().text(),
subject: item.find("td").eq(1).text(),
guests
}),
category: guests.split(/,|;/)
};
});
return {
title: `综艺秀 - ${$("h2").text()}`,
link: currentUrl,
item: items
};
}
//#endregion
export { route };