UNPKG

rsshub

Version:
50 lines (49 loc) 1.9 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.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 $ = load(await rofetch(url)); 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: "https://ja.hentai-cosplay-xxx.com/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 $ = load(await rofetch(info.link.replace("https://ja.hentai-cosplay-xxx.com/", "https://hentai-cosplay-xxx.com/"))); $("#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 };