33 lines
912 B
TypeScript
33 lines
912 B
TypeScript
import { FetchParams, GalleryData, VideoData } from "@/meta/data";
|
|
|
|
import { Platforms } from "@/meta/settings";
|
|
|
|
import { fetchXVideosGalleryData } from "./scrape/xvideos/gallery";
|
|
import { fetchXvideosVideoData } from "./scrape/xvideos/video";
|
|
|
|
export class VideoAgent {
|
|
platform: Platforms;
|
|
|
|
constructor(platform: Platforms) {
|
|
this.platform = platform
|
|
}
|
|
|
|
public getGallery = async (params?: FetchParams): Promise<GalleryData[]> => {
|
|
switch (this.platform) {
|
|
case Platforms.xvideos:
|
|
return await fetchXVideosGalleryData(params)
|
|
default:
|
|
return []
|
|
}
|
|
}
|
|
|
|
public getVideo = async (id: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
|
switch (this.platform) {
|
|
case Platforms.xvideos:
|
|
return await fetchXvideosVideoData(id, params)
|
|
default:
|
|
return [{ lowResUrl: '' }, []]
|
|
}
|
|
}
|
|
|
|
} |