UNPKG

rsshub

Version:
66 lines (64 loc) 2.27 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 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/baozimh/index.ts init_esm_shims(); const rootUrl = "https://www.baozimh.com"; const route = { path: "/comic/:name", categories: ["anime"], example: "/baozimh/comic/guowangpaiming-shiricaofu", parameters: { name: "漫画名称,在漫画链接可以得到(`comic/` 后的那段)" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www.baozimh.com/comic/:name"] }], name: "订阅漫画", maintainers: ["Fatpandac"], handler }; async function handler(ctx) { const url = `${rootUrl}/comic/${ctx.req.param("name")}`; const $ = load((await got_default(url)).data); const comicTitle = $("div > div.pure-u-1-1.pure-u-sm-2-3.pure-u-md-3-4 > div > h1").text(); const list = $("#chapter-items").first().children().toArray().map((item) => { return { title: $(item).find("span").text(), link: rootUrl + $(item).find("a").attr("href") }; }); const otherList = $("#chapters_other_list").first().children().toArray().map((item) => { return { title: $(item).find("span").text(), link: rootUrl + $(item).find("a").attr("href") }; }); const combinedList = [...list, ...otherList]; combinedList.reverse(); const items = await Promise.all(combinedList.map((item) => cache_default.tryGet(item.link, async () => { const $$1 = load((await got_default(item.link)).data); item.description = art(path.join(__dirname, "templates/desc-8ab6b3de.art"), { imgUrlList: $$1(".comic-contain").find("amp-img").toArray().map((item$1) => $$1(item$1).attr("src")) }); return item; }))); return { title: `包子漫画-${comicTitle}`, description: $(".comics-detail__desc").text(), link: url, item: items }; } //#endregion export { route };