add YouPorn base structure

This commit is contained in:
La macchina desiderante 2024-05-25 19:01:28 +02:00
parent 92a313aa2c
commit 089dddd385
7 changed files with 56 additions and 6 deletions

View File

@ -1,6 +1,6 @@
'use client' 'use client'
import { Cookies, Platforms, XVideosOrientations, PornHubOrientations } from '@/meta/settings'; import { Cookies, Platforms, XVideosOrientations, PornHubOrientations, YouPornOrientations } from '@/meta/settings';
import css from './Orientation.module.scss' import css from './Orientation.module.scss'
@ -19,7 +19,11 @@ interface Props {
const getOrientations = (platform: Platforms):Object => { const getOrientations = (platform: Platforms):Object => {
if ([Platforms.xnxx, Platforms.xvideos].includes(platform)) { if ([Platforms.xnxx, Platforms.xvideos].includes(platform)) {
return XVideosOrientations return XVideosOrientations
} }
if([Platforms.youporn].includes(platform)) {
return YouPornOrientations
}
return PornHubOrientations return PornHubOrientations
} }

View File

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

View File

@ -7,7 +7,8 @@ export enum Cookies {
export enum Platforms { export enum Platforms {
xvideos= 'xvideos', xvideos= 'xvideos',
xnxx= 'xnxx', xnxx= 'xnxx',
pornhub= 'pornhub' pornhub= 'pornhub',
youporn= 'youporn'
} }
export enum XVideosCatQueryMap { export enum XVideosCatQueryMap {
@ -27,6 +28,10 @@ export enum PornHubOrientations {
gay= 'gay' gay= 'gay'
} }
export enum YouPornOrientations {
generic= 'generic'
}
export enum Themes { export enum Themes {
light= 'light', light= 'light',
dark= 'dark', dark= 'dark',

View File

@ -5,12 +5,13 @@ import { Platforms } from "@/meta/settings";
import { XVideosAgent } from "./scrape/xvideos/agent"; import { XVideosAgent } from "./scrape/xvideos/agent";
import { XNXXAgent } from "./scrape/xnxx/agent"; import { XNXXAgent } from "./scrape/xnxx/agent";
import { PornHubAgent } from "./scrape/pornhub/agent"; import { PornHubAgent } from "./scrape/pornhub/agent";
import { YouPornAgent } from "./scrape/youporn/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,
} }
export class VideoAgent { export class VideoAgent {

View File

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

View File

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

View File

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