UNPKG

rsshub

Version:
50 lines (48 loc) 1.62 kB
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs"; import { n as parseRelativeDate } from "./parse-date-BrP7mxXf.mjs"; import { t as art } from "./render-BQo6B4tL.mjs"; import path from "node:path"; import dayjs from "dayjs"; //#region lib/routes/pornhub/utils.ts init_esm_shims(); const defaultDomain = "https://www.pornhub.com"; const headers = { accessAgeDisclaimerPH: 1, hasVisited: 1 }; const renderDescription = (data) => art(path.join(__dirname, "templates/description-6586ca20.art"), data); const extractDateFromImageUrl = (imageUrl) => { const matchResult = imageUrl.match(/(\d{6})\/(\d{2})/); return matchResult ? matchResult.slice(1, 3).join("") : null; }; const parseItems = (e) => ({ title: e.find("span.title a").text().trim(), link: defaultDomain + e.find("span.title a").attr("href"), description: renderDescription({ poster: e.find("img").data("mediumthumb"), previewVideo: e.find("img").data("mediabook") }), author: e.find(".usernameWrap a").text(), pubDate: dayjs(extractDateFromImageUrl(e.find("img").data("mediumthumb"))).toDate() || parseRelativeDate(e.find(".added").text()) }); const getRadarDomin = (path$1) => [{ source: [`www.pornhub.com${path$1}`, `www.pornhub.com${path$1}/*`], target: path$1 }, ...[ "de", "fr", "es", "it", "pt", "pl", "rt", "jp", "nl", "cz", "cn" ].map((language) => ({ source: [`${language}.pornhub.com${path$1}`, `${language}.pornhub.com${path$1}/*`], target: `${path$1}/${language}` }))]; //#endregion export { renderDescription as a, parseItems as i, getRadarDomin as n, headers as r, defaultDomain as t };