feat(core): hard remake with bun and elysia

This commit is contained in:
SNEK WAIFU
2026-05-14 04:37:39 +07:00
parent 07080d4a6a
commit f04bbead08
43 changed files with 721 additions and 1874 deletions

View File

@@ -1,45 +1,9 @@
import { scrapeContent } from "../../scraper/eporner/epornerGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function getEporner(req: Request, res: Response) {
export async function getEporner({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /eporner/get?id=:id Get eporner
* @apiName Get eporner
* @apiGroup eporner
* @apiDescription Get a eporner video based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/eporner/get?id=ibvqvezXzcs
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/eporner/get?id=ibvqvezXzcs")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/eporner/get?id=ibvqvezXzcs") as resp:
* print(await resp.json())
*/
// https://www.eporner.com/video-ibvqvezXzcs/ivy-seduces-her-dad-s-friend/
// https://www.eporner.com/hd-porn/hgovoiPexQe/Risa-Tsukino/
const { id } = query;
let path: string;
if (id.startsWith("video-")) {
@@ -51,16 +15,10 @@ export async function getEporner(req: Request, res: Response) {
const url = `${c.EPORNER}/${path}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent"),
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,28 +1,15 @@
import { scrapeContent } from "../../scraper/eporner/epornerGetRelatedController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function relatedEporner(req: Request, res: Response) {
export async function relatedEporner({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
const { id } = query;
const url = `${c.EPORNER}/video-${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,72 +1,32 @@
import { scrapeContent as searchScrape } from "../../scraper/eporner/epornerSearchController";
import { scrapeContent as videoScrape } from "../../scraper/eporner/epornerGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function randomEporner(req: Request, res: Response) {
/**
* @api {get} /eporner/random Get random eporner
* @apiName Get random eporner
* @apiGroup eporner
* @apiDescription Get a random eporner video
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/eporner/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/eporner/random")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/eporner/random") as resp:
* print(await resp.json())
*/
// cat/all/SORT-top-weekly/
try {
const weeklyUrl = `${c.EPORNER}/cat/all/SORT-top-weekly/`;
const list = await searchScrape(weeklyUrl);
if (!list.data.length) {
throw new Error("No weekly top videos found");
}
const random = list.data[Math.floor(Math.random() * list.data.length)];
let path: string;
if (random.id.startsWith("video-")) {
path = random.id;
} else {
path = `hd-porn/${random.id}`;
}
const url = `${c.EPORNER}/${path}`;
const data = await videoScrape(url);
logger.info({
path: req.path,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent"),
});
return res.json(data);
} catch (err) {
res.status(400).json(maybeError(false, (err as Error).message));
}
}
import { scrapeContent as searchScrape } from "../../scraper/eporner/epornerSearchController";
import { scrapeContent as videoScrape } from "../../scraper/eporner/epornerGetController";
import c from "../../utils/options";
export async function randomEporner() {
try {
const weeklyUrl = `${c.EPORNER}/cat/all/SORT-top-weekly/`;
const list = await searchScrape(weeklyUrl);
if (!list.data.length) {
throw new Error("No weekly top videos found");
}
const random = list.data[Math.floor(Math.random() * list.data.length)];
let path: string;
if (random.id.startsWith("video-")) {
path = random.id;
} else {
path = `hd-porn/${random.id}`;
}
const url = `${c.EPORNER}/${path}`;
const data = await videoScrape(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,72 +1,29 @@
import { scrapeContent } from "../../scraper/eporner/epornerSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function searchEporner(req: Request, res: Response) {
try {
/**
* @api {get} /eporner/search Search eporner videos
* @apiName Search eporner
* @apiGroup eporner
* @apiDescription Search eporner videos
* @apiParam {String} key Keyword to search
* @apiParam {Number} [page=1] Page number
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/eporner/search?key=milf
* curl -i https://lust.scathach.id/eporner/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/eporner/search?key=milf")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/eporner/search?key=milf") as resp:
* print(await resp.json())
*/
// https://www.eporner.com/tag/milf/
const key = req.query.key as string;
const page = Number(req.query.page || 1);
if (!key) throw Error("Parameter key is required");
if (isNaN(page)) throw Error("Parameter page must be a number");
const slug = key
.toLowerCase()
.trim()
.replace(/\s+/g, "-");
const url =
page === 1
? `${c.EPORNER}/tag/${slug}/`
: `${c.EPORNER}/tag/${slug}/${page}/`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/eporner/epornerSearchController";
import c from "../../utils/options";
export async function searchEporner({
query,
}: {
query: { key: string; page?: string };
}) {
try {
const { key } = query;
const page = Number(query.page || 1);
const slug = key
.toLowerCase()
.trim()
.replace(/\s+/g, "-");
const url =
page === 1
? `${c.EPORNER}/tag/${slug}/`
: `${c.EPORNER}/tag/${slug}/${page}/`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/pornhub/pornhubGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function getPornhub(req: Request, res: Response) {
export async function getPornhub({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /pornhub/get?id=:id Get Pornhub
* @apiName Get pornhub
* @apiGroup pornhub
* @apiDescription Get a pornhub video based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/pornhub/get?id=ph63c4e1dc48fe7
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/pornhub/get?id=ph63c4e1dc48fe7")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/pornhub/get?id=ph63c4e1dc48fe7") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.PORNHUB}/view_video.php?viewkey=${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/pornhub/pornhubSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function relatedPornhub(req: Request, res: Response) {
export async function relatedPornhub({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /pornhub/get?id=:id Get Pornhub related videos
* @apiName Get pornhub related videos
* @apiGroup pornhub
* @apiDescription Get a related pornhub videos based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/pornhub/get?id=ph63c4e1dc48fe7
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/pornhub/get?id=ph63c4e1dc48fe7")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/pornhub/get?id=ph63c4e1dc48fe7") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.PORNHUB}/view_video.php?viewkey=${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,50 +1,14 @@
import { Request, Response } from "express";
import { scrapeContent } from "../../scraper/pornhub/pornhubGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
export async function randomPornhub(req: Request, res: Response) {
export async function randomPornhub() {
try {
/**
* @api {get} /pornhub/random Random pornhub video
* @apiName Random pornhub
* @apiGroup pornhub
* @apiDescription Gets random pornhub video
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/pornhub/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/pornhub/random")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/pornhub/random") as resp:
* print(await resp.json())
*
*/
const url = `${c.PORNHUB}/video/random`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,66 +1,29 @@
import { scrapeContent } from "../../scraper/pornhub/pornhubSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError, spacer } from "../../utils/modifier";
import { Request, Response } from "express";
const sorting = ["mr", "mv", "tr", "lg"];
export async function searchPornhub(req: Request, res: Response) {
try {
/**
* @api {get} /pornhub/search Search pornhub videos
* @apiName Search pornhub
* @apiGroup pornhub
* @apiDescription Search pornhub videos
* @apiParam {String} key Keyword to search
* @apiParam {Number} [page=1] Page number
* @apiParam {String} [sort=mr] Sort by
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/pornhub/search?key=milf
* curl -i https://lust.scathach.id/pornhub/search?key=milf&page=2&sort=mr
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/pornhub/search?key=milf")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/pornhub/search?key=milf") as resp:
* print(await resp.json())
*/
const key = req.query.key as string;
const page = req.query.page || 1;
const sort = req.query.sort as string;
if (!key) throw Error("Parameter key is required");
if (isNaN(Number(page))) throw Error("Parameter page must be a number");
let url;
if (!sort) url = `${c.PORNHUB}/video/search?search=${spacer(key)}`;
else if (!sorting.includes(sort)) url = `${c.PORNHUB}/video/search?search=${spacer(key)}&page=${page}`;
else url = `${c.PORNHUB}/video/search?search=${spacer(key)}&o=${sort}&page=${page}`;
console.log(url);
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/pornhub/pornhubSearchController";
import c from "../../utils/options";
import { spacer } from "../../utils/modifier";
const sorting = ["mr", "mv", "tr", "lg"];
export async function searchPornhub({
query,
}: {
query: { key: string; page?: string; sort?: string };
}) {
try {
const { key, sort } = query;
const page = query.page || "1";
let url;
if (!sort) url = `${c.PORNHUB}/video/search?search=${spacer(key)}`;
else if (!sorting.includes(sort))
url = `${c.PORNHUB}/video/search?search=${spacer(key)}&page=${page}`;
else
url = `${c.PORNHUB}/video/search?search=${spacer(key)}&o=${sort}&page=${page}`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,56 +1,15 @@
import { scrapeContent } from "../../scraper/redtube/redtubeGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function getRedtube(req: Request, res: Response) {
export async function getRedtube({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
if (isNaN(Number(id))) throw Error("Parameter id must be a number");
/**
* @api {get} /redtube/get?id=:id Get Redtube
* @apiName Get redtube
* @apiGroup redtube
* @apiDescription Get a redtube video based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/redtube/get?id=42763661
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/redtube/get?id=42763661")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/redtube/get?id=42763661") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.REDTUBE}/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,54 +1,14 @@
import { scrapeContent } from "../../scraper/redtube/redtubeSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function relatedRedtube(req: Request, res: Response) {
try {
/**
* @api {get} /redtube/get?id=:id Get redtube related videos
* @apiName Get redtube related videos
* @apiGroup redtube
* @apiDescription Get a related redtube videos based on id
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/redtube/get?id=41698751
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/redtube/get?id=41698751")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/redtube/get?id=41698751") as resp:
* print(await resp.json())
*/
const id = req.query.id as string;
if (!id) throw Error("Parameter key is required");
if (isNaN(Number(id))) throw Error("Parameter id must be a number");
const url = `${c.REDTUBE}/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/redtube/redtubeSearchController";
import c from "../../utils/options";
export async function relatedRedtube({ query }: { query: { id: string } }) {
try {
const { id } = query;
const url = `${c.REDTUBE}/${id}`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,65 +1,25 @@
import { scrapeContent } from "../../scraper/redtube/redtubeGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
const lust = new LustPress();
export async function randomRedtube(req: Request, res: Response) {
export async function randomRedtube() {
try {
/**
* @api {get} /redtube/random Get random redtube
* @apiName Get random redtube
* @apiGroup redtube
* @apiDescription Get a random redtube video
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/redtube/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/redtube/random")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/redtube/random") as resp:
* print(await resp.json())
*/
const resolve = await lust.fetchBody(c.REDTUBE);
const $ = load(resolve);
const search = $("a.video_link")
.map((i, el) => {
return $(el).attr("href");
}).get();
})
.get();
const random = Math.floor(Math.random() * search.length);
const url = c.REDTUBE + search[random];
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,58 +1,21 @@
import { scrapeContent } from "../../scraper/redtube/redtubeSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError, spacer } from "../../utils/modifier";
import { Request, Response } from "express";
export async function searchRedtube(req: Request, res: Response) {
try {
/**
* @api {get} /redtube/search Search redtube videos
* @apiName Search redtube
* @apiGroup redtube
* @apiDescription Search redtube videos
* @apiParam {String} key Keyword to search
* @apiParam {Number} [page=1] Page number
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/redtube/search?key=milf
* curl -i https://lust.scathach.id/redtube/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/redtube/search?key=milf")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/redtube/search?key=milf") as resp:
* print(await resp.json())
*/
const key = req.query.key as string;
const page = req.query.page || 1;
if (!key) throw Error("Parameter key is required");
if (isNaN(Number(page))) throw Error("Parameter page must be a number");
const url = `${c.REDTUBE}/?search=${spacer(key)}&page=${page}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/redtube/redtubeSearchController";
import c from "../../utils/options";
import { spacer } from "../../utils/modifier";
export async function searchRedtube({
query,
}: {
query: { key: string; page?: string };
}) {
try {
const { key } = query;
const page = query.page || "1";
const url = `${c.REDTUBE}/?search=${spacer(key)}&page=${page}`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,10 +1,5 @@
import { Request, Response } from "express";
import LustPress from "../../LustPress";
import { maybeError } from "../../utils/modifier";
import { logger } from "../../utils/logger";
import { IVideoData } from "../../interfaces";
const lust = new LustPress();
import { lust } from "../../LustPress";
import { IVideoData, TxxxResponse } from "../../interfaces";
// Generate sharded API URL exactly like TXXX expects
function getApiUrl(videoId: string): string {
@@ -17,15 +12,13 @@ function getApiUrl(videoId: string): string {
return `https://txxx.com/api/json/video/86400/${million}/${thousand}/${id}.json`;
}
export async function getTxxx(req: Request, res: Response) {
export async function getTxxx({ query }: { query: { id: string } }) {
try {
const id = String(req.query.id || "").trim();
if (!id) throw new Error("Parameter id is required");
const { id } = query;
const apiUrl = getApiUrl(id);
const buffer = await lust.fetchBody(apiUrl);
const parsed = JSON.parse(buffer.toString("utf-8"));
const parsed = JSON.parse(buffer.toString("utf-8")) as TxxxResponse;
if (!parsed?.video) {
throw new Error("Invalid API response");
@@ -34,12 +27,12 @@ export async function getTxxx(req: Request, res: Response) {
const video = parsed.video;
const categories = Object.values(video.categories || {}).map(
(c: any) => c.title,
(c) => c.title
);
const tags = Object.values(video.tags || {}).map((t: any) => t.title);
const tags = Object.values(video.tags || {}).map((t) => t.title);
const models = Object.values(video.models || {}).map((m: any) => m.title);
const models = Object.values(video.models || {}).map((m) => m.title);
const videoDir = video.dir || "";
const videoId = video.video_id;
@@ -63,20 +56,14 @@ export async function getTxxx(req: Request, res: Response) {
tags: [...categories, ...tags],
},
source: `https://txxx.com/videos/${videoId}/${videoDir}/`,
assets: [embed, video.thumbsrc].filter(Boolean),
assets: [embed, video.thumbsrc].filter(Boolean) as string[],
};
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent"),
});
return res.json(response);
return response;
} catch (err) {
const e = err as Error;
return res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,10 +1,5 @@
import { Request, Response } from "express";
import LustPress from "../../LustPress";
import { maybeError } from "../../utils/modifier";
import { logger } from "../../utils/logger";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
import { lust } from "../../LustPress";
import { ISearchVideoData, TxxxRelatedResponse } from "../../interfaces";
function getRelatedApiUrl(videoId: string, page = 1, count = 50): string {
const id = Number(videoId);
@@ -19,10 +14,14 @@ function getRelatedApiUrl(videoId: string, page = 1, count = 50): string {
);
}
export async function relatedTxxx(req: Request, res: Response) {
export async function relatedTxxx({
query,
}: {
query: { id: string; page?: string };
}) {
try {
const id = String(req.query.id || "").trim();
const page = Number(req.query.page || 1);
const { id } = query;
const page = Number(query.page || 1);
if (!id) throw new Error("Parameter id is required");
if (Number.isNaN(page)) throw new Error("Parameter page must be a number");
@@ -30,14 +29,14 @@ export async function relatedTxxx(req: Request, res: Response) {
const apiUrl = getRelatedApiUrl(id, page);
const buffer = await lust.fetchBody(apiUrl);
const rawData = JSON.parse(buffer.toString("utf-8"));
const rawData = JSON.parse(buffer.toString("utf-8")) as TxxxRelatedResponse;
const videos = Array.isArray(rawData.videos) ? rawData.videos : [];
const data = videos.map((v: any) => ({
id: v.video_id,
const data = videos.map((v) => ({
id: String(v.video_id),
title: v.title,
image: v.scr || v.thumb || null,
image: v.scr || v.thumb || "",
duration: v.duration || "None",
views: v.video_viewed || "0",
rating: v.rating || "0",
@@ -46,24 +45,16 @@ export async function relatedTxxx(req: Request, res: Response) {
video: `https://txxx.com/embed/${v.video_id}/`,
}));
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent"),
});
return res.json({
return {
success: true,
total_count: rawData.total_count || "0",
total_count: String(rawData.total_count || "0"),
pages: rawData.pages || 1,
page,
data,
source: `https://txxx.com/videos/${id}/`,
} as ISearchVideoData);
} as unknown as ISearchVideoData;
} catch (err) {
const e = err as Error;
return res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,21 +1,15 @@
import { Request, Response } from "express";
import LustPress from "../../LustPress";
import { maybeError } from "../../utils/modifier";
import { logger } from "../../utils/logger";
import { lust } from "../../LustPress";
import { TxxxSearchResponse as TxxxResponse } from "../../interfaces";
const lust = new LustPress();
export async function randomTxxx(req: Request, res: Response) {
export async function randomTxxx() {
try {
const apiUrl =
"https://txxx.com/api/json/videos2/14400/str/most-popular/60/..1.all..day.json";
"https://txxx.com/api/json/videos2/14400/str/most-popular/60/..1.all..day.json";
const buffer = await lust.fetchBody(apiUrl);
const rawData = JSON.parse(buffer.toString("utf-8"));
const rawData = JSON.parse(buffer.toString("utf-8")) as TxxxResponse;
const videos = Array.isArray(rawData.videos)
? rawData.videos
: [];
const videos = Array.isArray(rawData.videos) ? rawData.videos : [];
if (videos.length === 0) {
throw new Error("No videos returned from upstream");
@@ -39,20 +33,15 @@ export async function randomTxxx(req: Request, res: Response) {
embed: `https://txxx.com/embed/${v.video_id}/`,
};
logger.info({
path: req.path,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent"),
});
return res.json({
return {
success: true,
data,
source: apiUrl,
});
};
} catch (err) {
const e = err as Error;
return res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,40 +1,27 @@
import { Request, Response } from "express";
import LustPress from "../../LustPress";
import { maybeError } from "../../utils/modifier";
import { lust } from "../../LustPress";
import { TxxxSearchResponse } from "../../interfaces";
const lust = new LustPress();
export async function searchTxxx(req: Request, res: Response) {
export async function searchTxxx({
query,
}: {
query: { key: string; page?: string };
}) {
try {
const key = String(req.query.key || "").trim();
const page = Number(req.query.page || 1);
if (!key) {
return res.json({
success: false,
error: "Parameter key is required",
});
}
if (Number.isNaN(page)) {
return res.json({
success: false,
error: "Parameter page must be a number",
});
}
const { key } = query;
const page = Number(query.page || 1);
const apiUrl =
"https://txxx.com/api/videos2.php" +
`?params=259200/str/relevance/60/search..${page}.all..` +
`&s=${encodeURIComponent(key)}`;
"https://txxx.com/api/videos2.php" +
`?params=259200/str/relevance/60/search..${page}.all..` +
`&s=${encodeURIComponent(key)}`;
// Fetch from API directly
const buffer = await lust.fetchBody(apiUrl);
const rawData = JSON.parse(buffer.toString("utf-8"));
const rawData = JSON.parse(buffer.toString("utf-8")) as TxxxSearchResponse;
const videos = Array.isArray(rawData.videos) ? rawData.videos : [];
const data = videos.map((v: any) => ({
const data = videos.map((v) => ({
video_id: v.video_id,
title: v.title,
dir: v.dir,
@@ -49,15 +36,17 @@ export async function searchTxxx(req: Request, res: Response) {
embed: `https://txxx.com/embed/${v.video_id}/`,
}));
return res.json({
return {
success: true,
total_count: String(rawData.total_count ?? videos.length),
pages: Number(rawData.pages ?? 1),
page,
data,
});
};
} catch (err) {
const e = err as Error;
return res.json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/xhamster/xhamsterGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function getXhamster(req: Request, res: Response) {
export async function getXhamster({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /xhamster/get?id=:id Get xhamster
* @apiName Get xhamster
* @apiGroup xhamster
* @apiDescription Get a xhamster video based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xhamster/get?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xhamster/get?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xhamster/get?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.XHAMSTER}/videos/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent"),
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/xhamster/xhamsterSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function relatedXhamster(req: Request, res: Response) {
export async function relatedXhamster({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /xhamster/get?id=:id Get related xhamster
* @apiName Get related xhamster
* @apiGroup xhamster
* @apiDescription Get a xhamster video based on related id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xhamster/related?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xhamster/related?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xhamster/related?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.XHAMSTER}/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,42 +1,10 @@
import { scrapeContent } from "../../scraper/xhamster/xhamsterGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
const lust = new LustPress();
export async function randomXhamster(req: Request, res: Response) {
export async function randomXhamster() {
try {
/**
* @api {get} /xhamster/random Get random xhamster video
* @apiName Get random xhamster
* @apiGroup xhamster
* @apiDescription Get a random xhamster video from the list of newest videos.
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xhamster/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xhamster/random")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xhamster/random") as resp:
* print(await resp.json())
*/
const resolve = await lust.fetchBody(`${c.XHAMSTER}/newest`);
const $ = load(resolve);
@@ -54,17 +22,10 @@ export async function randomXhamster(req: Request, res: Response) {
const data = await scrapeContent(randomUrl);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent"),
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,58 +1,21 @@
import { scrapeContent } from "../../scraper/xhamster/xhamsterSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError, spacer } from "../../utils/modifier";
import { Request, Response } from "express";
export async function searchXhamster(req: Request, res: Response) {
try {
/**
* @api {get} /xhamster/search Search xhamster videos
* @apiName Search xhamster
* @apiGroup xhamster
* @apiDescription Search xhamster videos
* @apiParam {String} key Keyword to search
* @apiParam {Number} [page=1] Page number
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xhamster/search?key=milf
* curl -i https://lust.scathach.id/xhamster/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xhamster/search?key=milf")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xhamster/search?key=milf") as resp:
* print(await resp.json())
*/
const key = req.query.key as string;
const page = req.query.page || 1;
if (!key) throw Error("Parameter key is required");
if (isNaN(Number(page))) throw Error("Parameter page must be a number");
const url = `${c.XHAMSTER}/search/${spacer(key)}?page=${page}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/xhamster/xhamsterSearchController";
import c from "../../utils/options";
import { spacer } from "../../utils/modifier";
export async function searchXhamster({
query,
}: {
query: { key: string; page?: string };
}) {
try {
const { key } = query;
const page = query.page || "1";
const url = `${c.XHAMSTER}/search/${spacer(key)}?page=${page}`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/xnxx/xnxxGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function getXnxx(req: Request, res: Response) {
export async function getXnxx({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /xnxx/get?id=:id Get xnxx
* @apiName Get xnxx
* @apiGroup xnxx
* @apiDescription Get a xnxx video based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xnxx/get?id=video-17vah71a/makima_y_denji
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xnxx/get?id=video-17vah71a/makima_y_denji")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xnxx/get?id=video-17vah71a/makima_y_denji") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.XNXX}/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/xnxx/xnxxGetRelatedController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function relatedXnxx(req: Request, res: Response) {
export async function relatedXnxx({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /xnxx/get?id=:id Get related xnxx
* @apiName Get related xnxx
* @apiGroup xnxx
* @apiDescription Get a xnxx video based on related id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xnxx/related?id=video-17vah71a/makima_y_denji
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xnxx/related?id=video-17vah71a/makima_y_denji")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xnxx/related?id=video-17vah71a/makima_y_denji") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.XNXX}/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,63 +1,27 @@
import { scrapeContent } from "../../scraper/xnxx/xnxxGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
import { lust } from "../../LustPress";
import { load } from "cheerio";
import LustPress from "../../LustPress";
const lust = new LustPress();
export async function randomXnxx(req: Request, res: Response) {
export async function randomXnxx() {
try {
/**
* @api {get} /xnxx/random Get random xnxx
* @apiName Get random xnxx
* @apiGroup xnxx
* @apiDescription Get a random xnxx video
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xnxx/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xnxx/random")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xnxx/random") as resp:
* print(await resp.json())
*/
const resolve = await lust.fetchBody("https://www.xnxx.com/search/random/random");
const resolve = await lust.fetchBody(
"https://www.xnxx.com/search/random/random"
);
const $ = load(resolve);
const search = $("div.mozaique > div")
.map((i, el) => {
return $(el).find("a").attr("href");
}).get();
})
.get();
const random = Math.floor(Math.random() * search.length);
const url = c.XNXX + search[random];
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,58 +1,20 @@
import { scrapeContent } from "../../scraper/xnxx/xnxxSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError, spacer } from "../../utils/modifier";
import { Request, Response } from "express";
export async function searchXnxx(req: Request, res: Response) {
try {
/**
* @api {get} /xnxx/search Search xnxx videos
* @apiName Search xnxx
* @apiGroup xnxx
* @apiDescription Search xnxx videos
* @apiParam {String} key Keyword to search
* @apiParam {Number} [page=0] Page number
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xnxx/search?key=milf
* curl -i https://lust.scathach.id/xnxx/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xnxx/search?key=milf")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xnxx/search?key=milf") as resp:
* print(await resp.json())
*/
const key = req.query.key as string;
const page = req.query.page || 0;
if (!key) throw Error("Parameter key is required");
if (isNaN(Number(page))) throw Error("Parameter page must be a number");
const url = `${c.XNXX}/search/${spacer(key)}/${page}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/xnxx/xnxxSearchController";
import c from "../../utils/options";
import { spacer } from "../../utils/modifier";
export async function searchXnxx({
query,
}: {
query: { key: string; page?: string };
}) {
try {
const { key } = query;
const page = query.page || "0";
const url = `${c.XNXX}/search/${spacer(key)}/${page}`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/xvideos/xvideosGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function getXvideos(req: Request, res: Response) {
export async function getXvideos({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /xvideos/get?id=:id Get xvideos
* @apiName Get xvideos
* @apiGroup xvideos
* @apiDescription Get a xvideos video based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xvideos/get?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xvideos/get?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xvideos/get?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.XVIDEOS}/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/xvideos/xvideosGetRelatedController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function relatedXvideos(req: Request, res: Response) {
export async function relatedXvideos({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /xvideos/get?id=:id Get related xvideos
* @apiName Get related xvideos
* @apiGroup xvideos
* @apiDescription Get a xvideos video based on related id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xvideos/related?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xvideos/related?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xvideos/related?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.XVIDEOS}/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,41 +1,10 @@
import { load } from "cheerio";
import { scrapeContent } from "../../scraper/xvideos/xvideosGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
const lust = new LustPress();
export async function randomXvideos(req: Request, res: Response) {
export async function randomXvideos() {
try {
/**
* @api {get} /xvideos/random Get random xvideos
* @apiName Get random xvideos
* @apiGroup xvideos
* @apiDescription Get a random xvideos video
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xvideos/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xvideos/random")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xvideos/random") as resp:
* print(await resp.json())
*/
const resolve = await lust.fetchBody(c.XVIDEOS);
const $ = load(resolve);
const search = $("div.thumb-under")
@@ -45,19 +14,13 @@ export async function randomXvideos(req: Request, res: Response) {
const filtered = search.filter((el) => el.includes("/video"));
const filtered_ = filtered.filter((el) => !el.includes("THUMBNUM"));
const random = Math.floor(Math.random() * filtered_.length);
const url = c.XVIDEOS + filtered[random];
const url = c.XVIDEOS + filtered_[random];
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,58 +1,21 @@
import { scrapeContent } from "../../scraper/xvideos/xvideosSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError, spacer } from "../../utils/modifier";
import { Request, Response } from "express";
export async function searchXvideos(req: Request, res: Response) {
try {
/**
* @api {get} /xvideos/search Search xvideos videos
* @apiName Search xvideos
* @apiGroup xvideos
* @apiDescription Search xvideos videos
* @apiParam {String} key Keyword to search
* @apiParam {Number} [page=0] Page number
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/xvideos/search?key=milf
* curl -i https://lust.scathach.id/xvideos/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/xvideos/search?key=milf")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/xvideos/search?key=milf") as resp:
* print(await resp.json())
*/
const key = req.query.key as string;
const page = req.query.page || 0;
if (!key) throw Error("Parameter key is required");
if (isNaN(Number(page))) throw Error("Parameter page must be a number");
const url = `${c.XVIDEOS}/?k=${spacer(key)}&p=${page}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/xvideos/xvideosSearchController";
import c from "../../utils/options";
import { spacer } from "../../utils/modifier";
export async function searchXvideos({
query,
}: {
query: { key: string; page?: string };
}) {
try {
const { key } = query;
const page = query.page || "0";
const url = `${c.XVIDEOS}/?k=${spacer(key)}&p=${page}`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/youporn/youpornGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function getYouporn(req: Request, res: Response) {
export async function getYouporn({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /youporn/get?id=:id Get youporn
* @apiName Get youporn
* @apiGroup youporn
* @apiDescription Get a youporn video based on id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/youporn/get?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/youporn/get?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/youporn/get?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.YOUPORN}/watch/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,55 +1,15 @@
import { scrapeContent } from "../../scraper/youporn/youpornSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
export async function relatedYouporn(req: Request, res: Response) {
export async function relatedYouporn({ query }: { query: { id: string } }) {
try {
const id = req.query.id as string;
if (!id) throw Error("Parameter id is required");
/**
* @api {get} /youporn/get?id=:id Get related youporn
* @apiName Get related youporn
* @apiGroup youporn
* @apiDescription Get a youporn video based on related id
*
* @apiParam {String} id Video ID
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/youporn/related?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/youporn/related?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/youporn/related?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps") as resp:
* print(await resp.json())
*/
const { id } = query;
const url = `${c.YOUPORN}/watch/${id}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,62 +1,23 @@
import { scrapeContent } from "../../scraper/youporn/youpornGetController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError } from "../../utils/modifier";
import { Request, Response } from "express";
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
const lust = new LustPress();
export async function randomYouporn(req: Request, res: Response) {
export async function randomYouporn() {
try {
/**
* @api {get} /youporn/random Get random youporn
* @apiName Get random youporn
* @apiGroup youporn
* @apiDescription Get a random youporn video
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/youporn/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/youporn/random")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/youporn/random") as resp:
* print(await resp.json())
*/
const resolve = await lust.fetchBody(`${c.YOUPORN}`);
const $ = load(resolve);
const search = $("a[href^='/watch/']")
.map((i, el) => {
return $(el).attr("href");
}).get();
})
.get();
const random = Math.floor(Math.random() * search.length);
const url = c.YOUPORN + search[random];
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
return data;
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
throw new Error(e.message);
}
}

View File

@@ -1,58 +1,21 @@
import { scrapeContent } from "../../scraper/youporn/youpornSearchController";
import c from "../../utils/options";
import { logger } from "../../utils/logger";
import { maybeError, spacer } from "../../utils/modifier";
import { Request, Response } from "express";
export async function searchYouporn(req: Request, res: Response) {
try {
/**
* @api {get} /youporn/search Search youporn videos
* @apiName Search youporn
* @apiGroup youporn
* @apiDescription Search youporn videos
* @apiParam {String} key Keyword to search
* @apiParam {Number} [page=1] Page number
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.scathach.id/youporn/search?key=milf
* curl -i https://lust.scathach.id/youporn/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.scathach.id/youporn/search?key=milf")
* .then(res => console.log(res.data))
* .catch(err => console.error(err))
*
* @apiExample {python} Python
* import aiohttp
* async with aiohttp.ClientSession() as session:
* async with session.get("https://lust.scathach.id/youporn/search?key=milf") as resp:
* print(await resp.json())
*/
const key = req.query.key as string;
const page = req.query.page || 1;
if (!key) throw Error("Parameter key is required");
if (isNaN(Number(page))) throw Error("Parameter page must be a number");
const url = `${c.YOUPORN}/search/?query=${spacer(key)}&page=${page}`;
const data = await scrapeContent(url);
logger.info({
path: req.path,
query: req.query,
method: req.method,
ip: req.ip,
useragent: req.get("User-Agent")
});
return res.json(data);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}
import { scrapeContent } from "../../scraper/youporn/youpornSearchController";
import c from "../../utils/options";
import { spacer } from "../../utils/modifier";
export async function searchYouporn({
query,
}: {
query: { key: string; page?: string };
}) {
try {
const { key } = query;
const page = query.page || "1";
const url = `${c.YOUPORN}/search/?query=${spacer(key)}&page=${page}`;
const data = await scrapeContent(url);
return data;
} catch (err) {
const e = err as Error;
throw new Error(e.message);
}
}

View File

@@ -1,9 +1,7 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
import { IVideoData } from "../../interfaces";
const lust = new LustPress();
function calculateRatingFromStrings(
upVote: string,
downVote: string

View File

@@ -1,9 +1,7 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
const html = await lust.fetchBody(url);
const $ = load(html);

View File

@@ -1,9 +1,7 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
import { IVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const resolve = await lust.fetchBody(url);

View File

@@ -1,59 +1,54 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class PornhubSearch {
search: object[];
data: object;
constructor() {
this.search = $("div.wrap")
.map((i, el) => {
const link = $(el).find("a").attr("href");
const id = link?.split("=")[1];
const title = $(el).find("a").attr("title");
const image = $(el).find("img").attr("src");
const duration = $(el).find("var.duration").text();
const views = $(el).find("div.videoDetailsBlock").find("span.views").text();
return {
link: `${c.PORNHUB}${link}`,
id: id,
title: title,
image: image,
duration: duration,
views: views,
video: `${c.PORNHUB}/embed/${id}`,
};
}).get();
this.data = this.search.filter((el: any) => {
return el.link.includes("javascript:void(0)") === false && el.image?.startsWith("data:image") === false;
});
}
}
const ph = new PornhubSearch();
if (ph.search.length === 0) throw Error("No result found");
const data = ph.data as string[];
const result: ISearchVideoData = {
success: true,
data: data,
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}
import { load } from "cheerio";
import { lust } from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData, PornhubSearchItem } from "../../interfaces";
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class PornhubSearch {
search: PornhubSearchItem[];
data: PornhubSearchItem[];
constructor() {
this.search = $("div.wrap")
.map((i, el) => {
const link = $(el).find("a").attr("href") || "";
const id = link.split("=")[1] || "None";
const title = $(el).find("a").attr("title") || "None";
const image = $(el).find("img").attr("src") || "None";
const duration = $(el).find("var.duration").text() || "None";
const views = $(el).find("div.videoDetailsBlock").find("span.views").text() || "None";
return {
link: `${c.PORNHUB}${link}`,
id: id,
title: title,
image: image,
duration: duration,
views: views,
video: `${c.PORNHUB}/embed/${id}`,
};
}).get();
this.data = this.search.filter((el) => {
return el.link.includes("javascript:void(0)") === false && el.image?.startsWith("data:image") === false;
});
}
}
const ph = new PornhubSearch();
if (ph.search.length === 0) throw Error("No result found");
const result: ISearchVideoData = {
success: true,
data: ph.data as unknown as string[],
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}

View File

@@ -1,72 +1,63 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class RedTubeSearch {
views: string[];
search: object[];
data: object;
constructor() {
this.views = $("span.video_count")
.map((i, el) => {
const views = $(el).text();
return views;
}).get();
this.search = $("a.video_link")
.map((i, el) => {
const link = $(el).attr("href");
const id = link?.split("/")[1];
const title = $(el).find("img").attr("alt");
const image = $(el).find("img").attr("data-src");
const duration = $(el).find("span.duration").text().split(" ").map((el: string) => {
return el.replace(/[^0-9:]/g, "");
}).filter((el: string) => {
return el.includes(":");
}).join(" ");
return {
link: `${c.REDTUBE}${link}`,
id: id,
title: title,
image: image,
duration: duration,
views: this.views[i],
video: `https://embed.redtube.com/?id=${id}`,
};
}).get();
this.data = this.search.filter((el: any) => {
return el.link.includes("javascript:void(0)") === false && el.image?.startsWith("data:image") === false;
});
}
}
const red = new RedTubeSearch();
if (red.search.length === 0) throw Error("No result found");
const data = red.data as string[];
const result: ISearchVideoData = {
success: true,
data: data,
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}
import { load } from "cheerio";
import { lust } from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData, RedTubeSearchItem } from "../../interfaces";
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class RedTubeSearch {
views: string[];
search: RedTubeSearchItem[];
data: RedTubeSearchItem[];
constructor() {
this.views = $("span.video_count")
.map((i, el) => {
return $(el).text();
}).get();
this.search = $("a.video_link")
.map((i, el) => {
const link = $(el).attr("href") || "";
const id = link.split("/")[1] || "None";
const title = $(el).find("img").attr("alt") || "None";
const image = $(el).find("img").attr("data-src") || "None";
const duration = $(el).find("span.duration").text().split(" ").map((el: string) => {
return el.replace(/[^0-9:]/g, "");
}).filter((el: string) => {
return el.includes(":");
}).join(" ");
return {
link: `${c.REDTUBE}${link}`,
id: id,
title: title,
image: image,
duration: duration,
views: this.views[i] || "None",
video: `https://embed.redtube.com/?id=${id}`,
};
}).get();
this.data = this.search.filter((el) => {
return el.link.includes("javascript:void(0)") === false && el.image?.startsWith("data:image") === false;
});
}
}
const red = new RedTubeSearch();
if (red.search.length === 0) throw Error("No result found");
const result: ISearchVideoData = {
success: true,
data: red.data as unknown as string[],
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}

View File

@@ -1,8 +1,6 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { IVideoData } from "../../interfaces";
const lust = new LustPress();
import { lust } from "../../LustPress";
import { IVideoData, XhamsterInitials } from "../../interfaces";
export async function scrapeContent(url: string) {
try {
@@ -10,11 +8,11 @@ export async function scrapeContent(url: string) {
const $ = load(buffer.toString("utf8"));
const raw = $("#initials-script").html();
const initials = raw
const initials = (raw
? JSON.parse(
raw.replace(/^window\.initials\s*=\s*/, "").replace(/;$/, ""),
)
: null;
: null) as XhamsterInitials | null;
class Xhamster {
link: string;
@@ -71,13 +69,13 @@ export async function scrapeContent(url: string) {
this.tags =
initials?.videoTagsComponent?.tags
?.filter((t: any) => t.isTag)
.map((t: any) => t.name) || [];
?.filter((t) => t.isTag)
.map((t) => t.name) || [];
this.models =
initials?.videoTagsComponent?.tags
?.filter((t: any) => t.isPornstar)
.map((t: any) => t.name) || [];
?.filter((t) => t.isPornstar)
.map((t) => t.name) || [];
const embedId = this.link.split("-").pop()?.replace("/", "");
this.video = embedId ? `https://xhamster.com/embed/${embedId}` : "None";
@@ -109,3 +107,4 @@ export async function scrapeContent(url: string) {
throw new Error(e.message);
}
}

View File

@@ -1,59 +1,54 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class XhamsterSearch {
search: any;
constructor() {
const views = $("div.video-thumb-views")
.map((i, el) => {
const views = $(el).text();
return views;
})
.get();
const duration = $("span[data-role='video-duration']")
.map((i, el) => {
const duration = $(el).text();
return duration;
})
.get();
this.search = $("a.video-thumb__image-container")
.map((i, el) => {
const link = $(el).attr("href");
return {
link: `${link}`,
id: link?.split("/")[4],
title: $(el).find("img").attr("alt"),
image: $(el).find("img").attr("src"),
duration: duration[i],
views: views[i],
video: `${c.XHAMSTER}/embed/${link?.split("-").pop()}`,
};
})
.get();
}
}
const xh = new XhamsterSearch();
if (xh.search.length === 0) throw Error("No result found");
const data = xh.search as unknown as string[];
const result: ISearchVideoData = {
success: true,
data: data,
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}
import { load } from "cheerio";
import { lust } from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData, XhamsterSearchItem } from "../../interfaces";
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class XhamsterSearch {
search: XhamsterSearchItem[];
constructor() {
const views = $("div.video-thumb-views")
.map((i, el) => {
return $(el).text();
})
.get();
const duration = $("span[data-role='video-duration']")
.map((i, el) => {
return $(el).text();
})
.get();
this.search = $("a.video-thumb__image-container")
.map((i, el) => {
const link = $(el).attr("href") || "";
return {
link: link,
id: link.split("/")[4] || "None",
title: $(el).find("img").attr("alt") || "None",
image: $(el).find("img").attr("src") || "None",
duration: duration[i] || "None",
views: views[i] || "None",
video: `${c.XHAMSTER}/embed/${link.split("-").pop()}`,
};
})
.get();
}
}
const xh = new XhamsterSearch();
if (xh.search.length === 0) throw Error("No result found");
const result: ISearchVideoData = {
success: true,
data: xh.search as unknown as string[],
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}

View File

@@ -1,56 +1,49 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class PornhubSearch {
search: object[];
data: object;
constructor() {
// in <div id="video-player-bg"> get <script>var video_related=
this.search = $("div#video-player-bg")
.map((i, el) => {
const script = $(el).find("script").html();
const video_related = script?.split("var video_related=")[1];
//stop and replace everything after the last ];
const badJson = video_related?.split("];")[0] + "]";
const actualResult = JSON.parse(String(badJson));
//console.log(actualResult);
const result = actualResult.map((el: any) => {
return {
link: `${c.XNXX}${el.u}`,
id: el.u.slice(1, -1),
title: el.t,
image: el.i,
duration: el.d,
views: `${el.n}, ${el.r}`,
video: `${c.XNXX}/embedframe/${el.id}`
};
});
return result;
}).get();
}
}
const x = new PornhubSearch();
if (x.search.length === 0) throw Error("No result found");
const data = x.search as unknown as string[];
const result: ISearchVideoData = {
success: true,
data: data,
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}
import { load } from "cheerio";
import { lust } from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData, XnxxRelatedRaw } from "../../interfaces";
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class XnxxSearch {
search: object[];
constructor() {
this.search = $("div#video-player-bg")
.map((i, el) => {
const script = $(el).find("script").html();
const video_related = script?.split("var video_related=")[1];
const badJson = video_related?.split("];")[0] + "]";
const actualResult = JSON.parse(String(badJson)) as XnxxRelatedRaw[];
const result = actualResult.map((rel) => {
return {
link: `${c.XNXX}${rel.u}`,
id: rel.u.slice(1, -1),
title: rel.t,
image: rel.i,
duration: rel.d,
views: `${rel.n}, ${rel.r}`,
video: `${c.XNXX}/embedframe/${rel.id}`
};
});
return result;
}).get();
}
}
const x = new XnxxSearch();
if (x.search.length === 0) throw Error("No result found");
const result: ISearchVideoData = {
success: true,
data: x.search as unknown as string[],
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}

View File

@@ -1,53 +1,49 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class XvideosSearch {
search: object[];
data: object;
constructor() {
this.search = $("div#video-player-bg")
.map((i, el) => {
const script = $(el).find("script").html();
const video_related = script?.split("var video_related=")[1];
const badJson = video_related?.split("];")[0] + "]";
const actualResult = JSON.parse(String(badJson));
const result = actualResult.map((el: any) => {
return {
link: `${c.XVIDEOS}${el.u}`,
id: el.u.slice(1, -1),
title: el.t,
image: el.i,
duration: el.d,
views: `${el.n}, ${el.r}`,
video: `${c.XVIDEOS}/embedframe/${el.id}`
};
});
return result;
}).get();
}
}
const x = new XvideosSearch();
if (x.search.length === 0) throw Error("No result found");
const data = x.search as unknown as string[];
const result: ISearchVideoData = {
success: true,
data: data,
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}
import { load } from "cheerio";
import { lust } from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData, XvideosRelatedRaw } from "../../interfaces";
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class XvideosSearch {
search: object[];
constructor() {
this.search = $("div#video-player-bg")
.map((i, el) => {
const script = $(el).find("script").html();
const video_related = script?.split("var video_related=")[1];
const badJson = video_related?.split("];")[0] + "]";
const actualResult = JSON.parse(String(badJson)) as XvideosRelatedRaw[];
const result = actualResult.map((rel) => {
return {
link: `${c.XVIDEOS}${rel.u}`,
id: rel.u.slice(1, -1),
title: rel.t,
image: rel.i,
duration: rel.d,
views: `${rel.n}, ${rel.r}`,
video: `${c.XVIDEOS}/embedframe/${rel.id}`
};
});
return result;
}).get();
}
}
const x = new XvideosSearch();
if (x.search.length === 0) throw Error("No result found");
const result: ISearchVideoData = {
success: true,
data: x.search as unknown as string[],
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}

View File

@@ -1,65 +1,64 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class XvideosSearch {
search: object[];
constructor() {
const data = $("div.thumb-under")
.map((i, el) => {
return {
title: $(el).find("a").attr("title"),
duration: $(el).find("span.duration")
.map((i, el) => {
return $(el).text();
}).get()[0],
};
}).get();
this.search = $("div.mozaique.cust-nb-cols")
.find("div.thumb")
.map((i, el) => {
return {
link: `${c.XVIDEOS}${$(el).find("a").attr("href")}` || "None",
id: $(el).find("a").attr("href") || "None",
image: $(el).find("img").attr("data-src") || "None",
title: data[i].title || "None",
duration: data[i].duration === data[i + 1]?.duration
? ""
: data[i].duration || "None",
rating: null,
video: `${c.XVIDEOS}/embedframe/${$(el).find("img").attr("data-videoid")}`
};
}).get();
this.search = this.search.filter((el: any) => {
return !el.id.includes("THUMBNUM");
});
this.search = this.search.filter((el: any) => {
return el.id.includes("/video");
});
}
}
const xv = new XvideosSearch();
if (xv.search.length === 0) throw Error("No result found");
const data = xv.search as unknown as string[];
const result: ISearchVideoData = {
success: true,
data: data,
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}
import { load } from "cheerio";
import { lust } from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData, XvideosSearchItem } from "../../interfaces";
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);
const $ = load(res);
class XvideosSearch {
search: XvideosSearchItem[];
constructor() {
const data = $("div.thumb-under")
.map((i, el) => {
return {
title: $(el).find("a").attr("title"),
duration: $(el).find("span.duration")
.map((i, el) => {
return $(el).text();
}).get()[0],
};
}).get();
this.search = $("div.mozaique.cust-nb-cols")
.find("div.thumb")
.map((i, el) => {
const href = $(el).find("a").attr("href") || "None";
const videoId = $(el).find("img").attr("data-videoid");
return {
link: `${c.XVIDEOS}${href}`,
id: href,
image: $(el).find("img").attr("data-src") || "None",
title: data[i]?.title || "None",
duration: data[i]?.duration === data[i + 1]?.duration
? ""
: data[i]?.duration || "None",
rating: null,
video: `${c.XVIDEOS}/embedframe/${videoId}`
};
}).get();
this.search = this.search.filter((el) => {
return !el.id.includes("THUMBNUM");
});
this.search = this.search.filter((el) => {
return el.id.includes("/video");
});
}
}
const xv = new XvideosSearch();
if (xv.search.length === 0) throw Error("No result found");
const result: ISearchVideoData = {
success: true,
data: xv.search as unknown as string[],
source: url,
};
return result;
} catch (err) {
const e = err as Error;
throw Error(e.message);
}
}

View File

@@ -1,10 +1,8 @@
import { load } from "cheerio";
import LustPress from "../../LustPress";
import { lust } from "../../LustPress";
import c from "../../utils/options";
import { ISearchVideoData } from "../../interfaces";
const lust = new LustPress();
export async function scrapeContent(url: string) {
try {
const res = await lust.fetchBody(url);