UNPKG

rsshub

Version:
49 lines (47 loc) 1.85 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import { t as cache_default } from "./cache-SV6W5EPy.mjs"; import "./helpers-Bo4JQYdN.mjs"; import "./got-CO-ndVl2.mjs"; import { n as getSimple, r as getTorrents, t as getDetails } from "./util-CignLrFj.mjs"; //#region lib/routes/nhentai/search.ts const route = { path: "/search/:keyword/:mode?", example: "/nhentai/search/language%3Ajapanese+-scat+-yaoi+-guro+-\"mosaic+censorship\"", parameters: { keyword: "Keywords for search. You can copy the content after `q=` after searching on the original website, or you can enter it directly. See the [official website](https://nhentai.net/info/) for details", mode: "mode, `simple` to only show cover, `detail` to show all pages, `torrent` to include Magnet URI, need login, refer to [Route-specific Configurations](https://docs.rsshub.app/deploy/config#route-specific-configurations), default to `simple`" }, features: { antiCrawler: true, supportBT: true, nsfw: true }, radar: [{ source: ["nhentai.net/:key/:keyword"], target: "/:key/:keyword" }], name: "Advanced Search", maintainers: ["MegrezZhu", "hoilc"], handler }; async function handler(ctx) { const { keyword, mode } = ctx.req.param(); const url = `https://nhentai.net/search/?q=${keyword}`; const simples = await getSimple(url); const limit = ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit")) : 5; let items = simples; if (mode === "detail") items = await getDetails(cache_default, simples, limit); else if (mode === "torrent") items = await getTorrents(cache_default, simples, limit); return { title: `nhentai - search - ${keyword}`, link: url, item: items }; } //#endregion export { route };