UNPKG

rsshub

Version:
59 lines (57 loc) 1.97 kB
import "./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 { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; import iconv from "iconv-lite"; //#region lib/routes/laimanhua/index.ts const route = { path: "/:id", categories: ["anime"], example: "/laimanhua/tiandikangzhanjiVERSUS", parameters: { id: "漫画 ID,可在 URL 中找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false, nsfw: true }, radar: [{ source: ["www.laimanhua8.com/kanmanhua/:id"] }], name: "漫画列表", maintainers: ["TonyRL"], handler }; async function handler(ctx) { const id = ctx.req.param("id"); const baseUrl = `https://www.laimanhua8.com`; const link = `${baseUrl}/kanmanhua/${id}/`; const { data: response } = await got_default(link, { responseType: "buffer" }); let $ = load(iconv.decode(response, "utf-8")); const charset = $("meta[http-equiv=\"Content-Type\"]").attr("content")?.match(/charset=(.*)/)?.[1]; if (charset?.toLowerCase() !== "utf-8") $ = load(iconv.decode(response, charset ?? "utf-8")); const items = $(".plist a").toArray().map((item, index) => { item = $(item); return { title: item.attr("title"), link: `${baseUrl}${item.attr("href")}`, pubDate: index === 0 ? parseDate($("head meta[property=\"og:novel:update_time\"]").attr("content")) : null, author: $("head meta[property=\"og:novel:author\"]").attr("content") }; }); return { title: `${$("head meta[property=\"og:novel:book_name\"]").attr("content")} - 来漫画`, description: $(".introduction").text(), image: $("head meta[property=\"og:image\"]").attr("content"), link, item: items }; } //#endregion export { route };