feat(controller): add each endpoint controller

このコミットが含まれているのは:
sinkaroid 2023-04-18 11:24:00 +07:00
コミット 3603e016cf
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: ABD69470B2390135
24個のファイルの変更1382行の追加0行の削除

55
src/controller/pornhub/pornhubGet.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/pornhub/get?id=ph63c4e1dc48fe7
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/pornhub/get?id=ph63c4e1dc48fe7") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

55
src/controller/pornhub/pornhubGetRelated.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/pornhub/get?id=ph63c4e1dc48fe7
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/pornhub/get?id=ph63c4e1dc48fe7") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

50
src/controller/pornhub/pornhubRandom.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,50 @@
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) {
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.sinkaroid.org/pornhub/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

66
src/controller/pornhub/pornhubSearch.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,66 @@
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.sinkaroid.org/pornhub/search?key=milf
* curl -i https://lust.sinkaroid.org/pornhub/search?key=milf&page=2&sort=mr
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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));
}
}

56
src/controller/redtube/redtubeGet.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,56 @@
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) {
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.sinkaroid.org/redtube/get?id=42763661
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/redtube/get?id=42763661") as resp:
* print(await resp.json())
*/
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));
}
}

54
src/controller/redtube/redtubeGetRelated.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,54 @@
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.sinkaroid.org/redtube/get?id=41698751
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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));
}
}

65
src/controller/redtube/redtubeRandom.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,65 @@
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";
const lust = new LustPress();
export async function randomRedtube(req: Request, res: Response) {
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.sinkaroid.org/redtube/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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();
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

58
src/controller/redtube/redtubeSearch.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,58 @@
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.sinkaroid.org/redtube/search?key=milf
* curl -i https://lust.sinkaroid.org/redtube/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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));
}
}

55
src/controller/xhamster/xhamsterGet.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/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.sinkaroid.org/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.sinkaroid.org/xhamster/get?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

55
src/controller/xhamster/xhamsterGetRelated.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/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.sinkaroid.org/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.sinkaroid.org/xhamster/related?id=videos/horny-makima-tests-new-toy-and-cums-intensely-xhAa5wx") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

63
src/controller/xhamster/xhamsterRandom.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,63 @@
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";
const lust = new LustPress();
export async function randomXhamster(req: Request, res: Response) {
try {
/**
* @api {get} /xhamster/random Get random xhamster
* @apiName Get random xhamster
* @apiGroup xhamster
* @apiDescription Get a random xhamster video
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* HTTP/1.1 400 Bad Request
*
* @apiExample {curl} curl
* curl -i https://lust.sinkaroid.org/xhamster/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/xhamster/random") as resp:
* print(await resp.json())
*/
const resolve = await lust.fetchBody(`${c.XHAMSTER}/newest`);
const $ = load(resolve);
const search = $("a.root-9d8b4.video-thumb-info__name.role-pop.with-dropdown")
.map((i, el) => $(el).attr("href"))
.get();
const search_ = search.map((el) => el.replace(c.XHAMSTER, ""));
const random = Math.floor(Math.random() * search_.length);
const url = c.XHAMSTER + 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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

58
src/controller/xhamster/xhamsterSearch.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,58 @@
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.sinkaroid.org/xhamster/search?key=milf
* curl -i https://lust.sinkaroid.org/xhamster/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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));
}
}

55
src/controller/xnxx/xnxxGet.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/xnxx/get?id=video-17vah71a/makima_y_denji
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/xnxx/get?id=video-17vah71a/makima_y_denji") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

55
src/controller/xnxx/xnxxGetRelated.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/xnxx/related?id=video-17vah71a/makima_y_denji
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/xnxx/related?id=video-17vah71a/makima_y_denji") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

63
src/controller/xnxx/xnxxRandom.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,63 @@
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 { load } from "cheerio";
import LustPress from "../../LustPress";
const lust = new LustPress();
export async function randomXnxx(req: Request, res: Response) {
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.sinkaroid.org/xnxx/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/xnxx/random") as resp:
* print(await resp.json())
*/
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();
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

58
src/controller/xnxx/xnxxSearch.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,58 @@
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.sinkaroid.org/xnxx/search?key=milf
* curl -i https://lust.sinkaroid.org/xnxx/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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));
}
}

55
src/controller/xvideos/xvideosGet.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/xvideos/get?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/xvideos/get?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

55
src/controller/xvideos/xvideosGetRelated.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/xvideos/related?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/xvideos/related?id=video73564387/cute_hentai_maid_with_pink_hair_fucking_uncensored_") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

63
src/controller/xvideos/xvideosRandom.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,63 @@
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";
const lust = new LustPress();
export async function randomXvideos(req: Request, res: Response) {
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.sinkaroid.org/xvideos/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/xvideos/random") as resp:
* print(await resp.json())
*/
const resolve = await lust.fetchBody(c.XVIDEOS);
const $ = load(resolve);
const search = $("div.thumb-under")
.find("a")
.map((i, el) => $(el).attr("href"))
.get();
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 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));
}
}

58
src/controller/xvideos/xvideosSearch.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,58 @@
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.sinkaroid.org/xvideos/search?key=milf
* curl -i https://lust.sinkaroid.org/xvideos/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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));
}
}

55
src/controller/youporn/youpornGet.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/youporn/get?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/youporn/get?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

55
src/controller/youporn/youpornGetRelated.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,55 @@
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) {
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.sinkaroid.org/youporn/related?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/youporn/related?id=16621192/chainsaw-man-fuck-makima-3d-porn-60-fps") as resp:
* print(await resp.json())
*/
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

62
src/controller/youporn/youpornRandom.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,62 @@
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";
const lust = new LustPress();
export async function randomYouporn(req: Request, res: Response) {
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.sinkaroid.org/youporn/random
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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();
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);
} catch (err) {
const e = err as Error;
res.status(400).json(maybeError(false, e.message));
}
}

58
src/controller/youporn/youpornSearch.ts ノーマルファイル
ファイルの表示

@ -0,0 +1,58 @@
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.sinkaroid.org/youporn/search?key=milf
* curl -i https://lust.sinkaroid.org/youporn/search?key=milf&page=2
*
* @apiExample {js} JS/TS
* import axios from "axios"
*
* axios.get("https://lust.sinkaroid.org/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.sinkaroid.org/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));
}
}