UNPKG

rsshub

Version:
75 lines (73 loc) 2.23 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 path from "node:path"; import { load } from "cheerio"; //#region lib/routes/storyfm/episodes.ts init_esm_shims(); const route = { path: "/episodes", categories: ["multimedia"], example: "/storyfm/episodes", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: true, supportScihub: false }, radar: [{ source: ["storyfm.cn/episodes-list", "storyfm.cn/"] }], name: "播客", maintainers: ["nczitzk"], handler, url: "storyfm.cn/episodes-list" }; async function handler() { const currentUrl = `https://storyfm.cn/episodes-list/`; const $ = load((await got_default({ method: "get", url: currentUrl })).data); let items = $(".e-ep").toArray().map((item) => { item = $(item); const a = item.find("h2.e-ep__title a"); return { title: a.text(), link: a.attr("href"), pubDate: parseDate(item.find(".whitespace-nowrap").text()), enclosure_type: "audio/mpeg", enclosure_url: item.find("audio source").attr("src"), itunes_item_image: item.find(".zoom-image-container-progression img").attr("src") }; }); items = await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => { const content = load((await got_default({ method: "get", url: item.link })).data); item.author = content(".rs-post__author").text().replace(/By/, "").trim(); item.description = art(path.join(__dirname, "templates/description-7687a204.art"), { audio: item.enclosure_url, description: content(".rs-post__content").html() }); return item; }))); return { title: "故事FM", link: currentUrl, item: items, itunes_author: "故事FM", image: $(".custom-logo-link img").attr("src") }; } //#endregion export { route };