UNPKG

rsshub

Version:
42 lines (40 loc) 1.33 kB
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.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/95mm/utils.ts init_esm_shims(); const rootUrl = "https://www.95mm.vip"; const ProcessItems = async (ctx, title, currentUrl) => { const $ = load((await got_default({ method: "get", url: currentUrl, headers: { Referer: rootUrl } })).data); let items = $("div.list-body").toArray().map((item) => { item = $(item); const a = item.find("a"); return { title: a.text(), link: a.attr("href"), guid: a.attr("href").replace("95mm.vip", "95mm.org") }; }); items = await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => { const images = (await got_default({ method: "get", url: item.link })).data.match(/src": '(.*?)',"width/g); item.description = art(path.join(__dirname, "templates/description-7371506b.art"), { images: images.map((i) => i.split("'")[1].replaceAll(String.raw`\/`, "/")) }); return item; }))); return { title: `${title} - MM范`, link: currentUrl, item: items }; }; //#endregion export { rootUrl as n, ProcessItems as t };