UNPKG

rsshub

Version:
52 lines (51 loc) 1.94 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { load } from "cheerio"; //#region lib/routes/hentai-cosplays-xxx/index.ts const route = { path: "/:type?/:name?", categories: ["picture"], example: "/hentai-cosplays-xxx/tag/jk", parameters: { type: "搜索类型, `tag`为标签, `keyword`为关键字, 默认留空为全部", name: "搜索内容, 可在 URL 中找到,默认留空为全部" }, features: { antiCrawler: true }, name: "最新图片", maintainers: ["hoilc"], handler }; const host = "https://ja.hentai-cosplay-xxx.com/"; async function handler(ctx) { const { type, name } = ctx.req.param(); const url = type ? `${host}search/${type}/${encodeURIComponent(name)}/` : `${host}search/`; const response = await rofetch(url); const $ = load(response); const list = $("#display_area_image").first().find("ul#image-list li").toArray().map((item) => { const $item = $(item); return { title: $item.find(".image-list-item-title").text().trim(), link: host + "story" + $item.find(".image-list-item-title > a").attr("href").replace("/image", ""), date: $item.find(".image-list-item-regist-date > span").text() }; }); const items = await Promise.all(list.map((info) => cache_default.tryGet(info.link, async () => { const detailResponse = await rofetch(info.link.replace("https://ja.hentai-cosplay-xxx.com/", "https://hentai-cosplay-xxx.com/")); const $ = load(detailResponse); $("#custom-bookend-scrollable").remove(); return { title: info.title, link: info.link, description: $("amp-img").toArray().map((element) => `<img src=${$(element).attr("src")} alt="">`).join(" "), pubDate: parseDate(info.date) }; }))); return { title: `${name || "新着画像一覧"} - エロ画像`, link: url, item: items }; } //#endregion export { route };