27 lines
766 B
TypeScript
27 lines
766 B
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";
|
|
|
|
const AgentMapper = {
|
|
[Platforms.xvideos]: XVideosAgent,
|
|
[Platforms.xnxx]: XNXXAgent
|
|
}
|
|
|
|
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)
|
|
}
|
|
} |