33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { FetchParams, GalleryData, VideoData } from "@/meta/data";
|
|
|
|
import { Platforms } from "@/meta/settings";
|
|
|
|
import { XVideosAgent } from "./scrape/xvideos/agent";
|
|
import { XNXXAgent } from "./scrape/xnxx/agent";
|
|
import { PornHubAgent } from "./scrape/pornhub/agent";
|
|
import { YouPornAgent } from "./scrape/youporn/agent";
|
|
import { RedTubeAgent } from "./scrape/redtube/agent";
|
|
|
|
const AgentMapper = {
|
|
[Platforms.xvideos]: XVideosAgent,
|
|
[Platforms.xnxx]: XNXXAgent,
|
|
[Platforms.pornhub]: PornHubAgent,
|
|
[Platforms.youporn]: YouPornAgent,
|
|
[Platforms.redtube]: RedTubeAgent
|
|
}
|
|
|
|
export class VideoAgent {
|
|
platform: Platforms;
|
|
|
|
constructor(platform: Platforms) {
|
|
this.platform = platform
|
|
}
|
|
|
|
public getGallery = async (params?: FetchParams): Promise<GalleryData[]> => {
|
|
return await new AgentMapper[this.platform]().getGallery(params)
|
|
}
|
|
|
|
public getVideo = async (id: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
|
return await new AgentMapper[this.platform]().getVideo(id, params)
|
|
}
|
|
} |