rsshub
Version:
Make RSS Great Again!
58 lines (53 loc) • 2.01 kB
JavaScript
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 "./helpers-Bo4JQYdN.mjs";
import { t as got_default } from "./got-CO-ndVl2.mjs";
import { t as invalid_parameter_default } from "./invalid-parameter-ByDtry1B.mjs";
import { t as isValidHost } from "./valid-host-DqbCYAHY.mjs";
import { i as parseItems, r as headers } from "./utils-D1hBzcqc.mjs";
import { load } from "cheerio";
//#region lib/routes/pornhub/category-url.ts
const route = {
path: "/category_url/:url?/:language?",
categories: ["multimedia"],
example: "/pornhub/category_url/video%3Fc%3D15%26o%3Dmv%26t%3Dw%26cc%3Djp",
parameters: {
language: "language, see below",
url: "relative path after `pornhub.com/`, need to be URL encoded"
},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true
},
name: "Video List",
maintainers: ["I2IMk", "queensferryme"],
handler,
description: `**\`language\`**
Refer to [Pornhub F.A.Qs](https://help.pornhub.com/hc/en-us/articles/360044327034-How-do-I-change-the-language-), English by default. For example:
- \`cn\` (Chinese), for Pornhub in China [https://cn.pornhub.com](https://cn.pornhub.com);
- \`jp\` (Japanese), for Pornhub in Japan [https://jp.pornhub.com](https://jp.pornhub.com) etc.`
};
async function handler(ctx) {
const { language = "www", url = "video" } = ctx.req.param();
const link = `https://${language}.pornhub.com/${url}`;
if (!isValidHost(language)) throw new invalid_parameter_default("Invalid language");
const { data: response } = await got_default(link, { headers });
const $ = load(response);
const items = $("#videoCategory .videoBox").toArray().map((e) => parseItems($(e)));
return {
title: $("title").first().text(),
link,
language: $("html").attr("lang"),
item: items
};
}
//#endregion
export { route };