UNPKG

rsshub

Version:
124 lines (109 loc) 5.41 kB
import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs"; import { t as got_default } from "./got-BTowW50G.mjs"; import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime"; import { load } from "cheerio"; import { renderToString } from "hono/jsx/dom/server"; //#region lib/routes/141jav/index.tsx const route = { path: "/:type/:keyword{.+}?", categories: ["multimedia"], example: "/141jav/popular/30", name: "通用", maintainers: ["cgkings", "nczitzk"], parameters: { type: "类型,可查看下表的类型说明", keyword: "关键词,可查看下表的关键词说明" }, handler, description: `**类型** | 最新 | 热门 | 随机 | 指定演员 | 指定标签 | 日期 | | ---- | ------- | ------ | -------- | -------- | ---- | | new | popular | random | actress | tag | date | **关键词** | 空 | 日期范围 | 演员名 | 标签名 | 年月日 | | -- | ----------- | ------------ | -------------- | ---------- | | | 7 / 30 / 60 | Yua%20Mikami | Adult%20Awards | 2020/07/30 | **示例说明** - \`/141jav/new\` 仅当类型为 \`new\` \`popular\` 或 \`random\` 时关键词为 **空** - \`/141jav/popular/30\` \`popular\` \`random\` 类型的关键词可填写 \`7\` \`30\` 或 \`60\` 三个 **日期范围** 之一,分别对应 **7 天**、**30 天** 或 **60 天内** - \`/141jav/actress/Yua%20Mikami\` \`actress\` 类型的关键词必须填写 **演员名** ,可在 [此处](https://141jav.com/actress/) 演员单页链接中获取 - \`/141jav/tag/Adult%20Awards\` \`tag\` 类型的关键词必须填写 **标签名** 且标签中的 \`/\` 必须替换为 \`%2F\` ,可在 [此处](https://141jav.com/tag/) 标签单页链接中获取 - \`/141jav/date/2020/07/30\` \`date\` 类型的关键词必须填写 **日期 (年 / 月 / 日)**`, features: { nsfw: true } }; async function handler(ctx) { const rootUrl = "https://www.141jav.com"; const type = ctx.req.param("type"); const keyword = ctx.req.param("keyword") ?? ""; const currentUrl = `${rootUrl}/${type}${keyword ? `/${keyword}` : ""}`; const $ = load((await got_default({ method: "get", url: currentUrl })).data); const items = $(".columns").toArray().map((item) => { const $item = $(item); const id = $item.find(".title a").text(); const size = $item.find(".title span").text(); const pubDate = $item.find(".subtitle a").attr("href").split("/date/").pop(); const description = $item.find(".has-text-grey-dark").text(); const actresses = $item.find(".panel-block").toArray().map((a) => $(a).text().trim()); const tags = $item.find(".tag").toArray().map((t) => $(t).text().trim()); const magnet = $item.find("a[title=\"Magnet torrent\"]").attr("href"); const link = $item.find("a[title=\"Download .torrent\"]").attr("href"); const image = $item.find(".image").attr("src"); return { title: `${id} ${size}`, pubDate: parseDate(pubDate, "YYYY/MM/DD"), link: new URL($item.find("a").first().attr("href"), rootUrl).href, description: renderToString(/* @__PURE__ */ jsx(JavDescription, { image, id, size, pubDate, description, actresses, tags, magnet, link })), author: actresses.join(", "), category: [...tags, ...actresses], enclosure_type: "application/x-bittorrent", enclosure_url: magnet }; }); return { title: `141JAV - ${$("title").text().split("-", 1)[0].trim()}`, link: currentUrl, item: items }; } const JavDescription = ({ image, id, size, pubDate, description, actresses, tags, magnet, link }) => /* @__PURE__ */ jsxs(Fragment, { children: [image ? /* @__PURE__ */ jsx("img", { src: image }) : null, /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsxs("tbody", { children: [ /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "ID" }), /* @__PURE__ */ jsx("td", { children: id })] }), /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "Size" }), /* @__PURE__ */ jsx("td", { children: size })] }), /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "Date" }), /* @__PURE__ */ jsx("td", { children: pubDate })] }), /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "Description" }), /* @__PURE__ */ jsx("td", { children: description })] }), /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "Actress" }), /* @__PURE__ */ jsx("td", { children: actresses.map((actress) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("a", { href: `/actress/${actress}`, children: actress }), "\xA0"] })) })] }), /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "Tag" }), /* @__PURE__ */ jsx("td", { children: tags.map((tag) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("a", { href: `/tag/${tag}`, children: tag }), "\xA0"] })) })] }), /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "Magnet torrent" }), /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("a", { href: magnet, children: "Magnet torrent link" }) })] }), /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "Download .torrent" }), /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("a", { href: link, children: "Download torrent" }) })] }) ] }) })] }); //#endregion export { route };