* static files changes * remake modifiers * test case * some docs changes * deps and rule changes * edit proper interfaces * remake getServer * @elysiajs/swagger * remake tsconfig * ci changes use bun * docs changes * feat(core): hard remake with bun and elysia * chore(release): 8.2.0-alpha * auto release * ci * update global * chore(release): 8.2.1-alpha * ci
24 lines
696 B
TypeScript
24 lines
696 B
TypeScript
import { scrapeContent } from "../../scraper/youporn/youpornGetController";
|
|
import c from "../../utils/options";
|
|
import { load } from "cheerio";
|
|
import { lust } from "../../LustPress";
|
|
|
|
export async function randomYouporn() {
|
|
try {
|
|
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);
|
|
return data;
|
|
} catch (err) {
|
|
const e = err as Error;
|
|
throw new Error(e.message);
|
|
}
|
|
}
|