v0.4.1/add-xhamster-support #114

Merged
lamacchinadesiderante merged 3 commits from v0.4.1/add-xhamster-support into develop 2024-05-28 19:44:15 +00:00
7 changed files with 57 additions and 4 deletions
Showing only changes of commit 291c6efe55 - Show all commits

View File

@ -1,6 +1,6 @@
'use client' 'use client'
import { Cookies, Platforms, XVideosOrientations, PornHubOrientations, YouPornOrientations, RedTubeOrientations } from '@/meta/settings'; import { Cookies, Platforms, XVideosOrientations, PornHubOrientations, YouPornOrientations, RedTubeOrientations, XHamsterOrientations } from '@/meta/settings';
import css from './Orientation.module.scss' import css from './Orientation.module.scss'
@ -29,6 +29,10 @@ const getOrientations = (platform: Platforms):Object => {
return RedTubeOrientations return RedTubeOrientations
} }
if([Platforms.xhamster].includes(platform)) {
return XHamsterOrientations
}
return PornHubOrientations return PornHubOrientations
} }

View File

@ -1,6 +1,6 @@
'use client' 'use client'
import { Cookies, Platforms, PornHubOrientations, RedTubeOrientations, XVideosOrientations, YouPornOrientations } from '@/meta/settings'; import { Cookies, Platforms, PornHubOrientations, RedTubeOrientations, XHamsterOrientations, XVideosOrientations, YouPornOrientations } from '@/meta/settings';
import css from './Platform.module.scss' import css from './Platform.module.scss'
@ -31,6 +31,10 @@ const mapOrientationToPlatform = (platform: string, orientation: string): string
return Object.keys(RedTubeOrientations).includes(orientation) ? orientation : String(RedTubeOrientations.etero) return Object.keys(RedTubeOrientations).includes(orientation) ? orientation : String(RedTubeOrientations.etero)
} }
if ([String(Platforms.xhamster)].includes(platform)) {
return Object.keys(XHamsterOrientations).includes(orientation) ? orientation : String(XHamsterOrientations.etero)
}
if ([String(Platforms.youporn)].includes(platform)) { if ([String(Platforms.youporn)].includes(platform)) {
return String(YouPornOrientations.generic) return String(YouPornOrientations.generic)
} }

View File

@ -9,7 +9,8 @@ export enum Platforms {
xnxx= 'xnxx', xnxx= 'xnxx',
pornhub= 'pornhub', pornhub= 'pornhub',
youporn= 'youporn', youporn= 'youporn',
redtube= 'redtube' redtube= 'redtube',
xhamster= 'xhamster'
} }
export enum XVideosCatQueryMap { export enum XVideosCatQueryMap {
@ -39,6 +40,12 @@ export enum RedTubeOrientations {
trans= 'trans' trans= 'trans'
} }
export enum XHamsterOrientations {
etero= 'etero',
gay= 'gay',
trans= 'trans'
}
export enum Themes { export enum Themes {
light= 'light', light= 'light',
dark= 'dark', dark= 'dark',

View File

@ -7,13 +7,15 @@ import { XNXXAgent } from "./scrape/xnxx/agent";
import { PornHubAgent } from "./scrape/pornhub/agent"; import { PornHubAgent } from "./scrape/pornhub/agent";
import { YouPornAgent } from "./scrape/youporn/agent"; import { YouPornAgent } from "./scrape/youporn/agent";
import { RedTubeAgent } from "./scrape/redtube/agent"; import { RedTubeAgent } from "./scrape/redtube/agent";
import { XHamsterAgent } from "./scrape/xhamster/agent";
const AgentMapper = { const AgentMapper = {
[Platforms.xvideos]: XVideosAgent, [Platforms.xvideos]: XVideosAgent,
[Platforms.xnxx]: XNXXAgent, [Platforms.xnxx]: XNXXAgent,
[Platforms.pornhub]: PornHubAgent, [Platforms.pornhub]: PornHubAgent,
[Platforms.youporn]: YouPornAgent, [Platforms.youporn]: YouPornAgent,
[Platforms.redtube]: RedTubeAgent [Platforms.redtube]: RedTubeAgent,
[Platforms.xhamster]: XHamsterAgent
} }
export class VideoAgent { export class VideoAgent {

View File

@ -0,0 +1,15 @@
import { FetchParams, GalleryData, VideoAgent, VideoData } from "@/meta/data";
import { fetchXHamsterGalleryData } from "./gallery";
import { fetchXHamsterVideoData } from "./video";
export class XHamsterAgent implements VideoAgent {
public getGallery = async (params?: FetchParams): Promise<GalleryData[]> => {
return await fetchXHamsterGalleryData(params)
}
public getVideo = async (id: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
return await fetchXHamsterVideoData(id, params)
}
}

View File

@ -0,0 +1,8 @@
import { FetchParams, GalleryData } from "@/meta/data";
export const fetchXHamsterGalleryData = async (params?: FetchParams): Promise<GalleryData[]> => {
let data: GalleryData[] = [];
return data
}

View File

@ -0,0 +1,13 @@
import { FetchParams, GalleryData, VideoData, VideoSourceItem } from "@/meta/data";
export const fetchXHamsterVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
let data: VideoData = {
hlsUrl: '',
srcSet: []
}
let relatedData: GalleryData[] = [];
return [ data, relatedData ]
}