Release v0.4.0: Add Redtube support #103
			
				
			
		
		
		
	| 
						 | 
					@ -8,7 +8,8 @@ export enum Platforms {
 | 
				
			||||||
    xvideos= 'xvideos',
 | 
					    xvideos= 'xvideos',
 | 
				
			||||||
    xnxx= 'xnxx',
 | 
					    xnxx= 'xnxx',
 | 
				
			||||||
    pornhub= 'pornhub',
 | 
					    pornhub= 'pornhub',
 | 
				
			||||||
    youporn= 'youporn'
 | 
					    youporn= 'youporn',
 | 
				
			||||||
 | 
					    redtube= 'redtube'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export enum XVideosCatQueryMap {
 | 
					export enum XVideosCatQueryMap {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,12 +6,14 @@ 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";
 | 
					import { YouPornAgent } from "./scrape/youporn/agent";
 | 
				
			||||||
 | 
					import { RedTubeAgent } from "./scrape/redtube/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
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class VideoAgent {
 | 
					export class VideoAgent {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					import { FetchParams, GalleryData, VideoAgent, VideoData } from "@/meta/data";
 | 
				
			||||||
 | 
					import { fetchRedTubeGalleryData } from "./gallery";
 | 
				
			||||||
 | 
					import { fetchRedTubeVideoData } from "./video";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export class RedTubeAgent implements VideoAgent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public getGallery = async (params?: FetchParams): Promise<GalleryData[]> => {
 | 
				
			||||||
 | 
					        return await fetchRedTubeGalleryData(params)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public getVideo = async (id: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
 | 
				
			||||||
 | 
					        return await fetchRedTubeVideoData(id, params)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					import { FetchParams, GalleryData } from "@/meta/data";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const fetchRedTubeGalleryData = async (params?: FetchParams): Promise<GalleryData[]> => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let data: GalleryData[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return data
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					import { FetchParams, GalleryData, VideoData, VideoSourceItem } from "@/meta/data";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const fetchRedTubeVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let data: VideoData = {
 | 
				
			||||||
 | 
					        hlsUrl: '',
 | 
				
			||||||
 | 
					        srcSet: []
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let relatedData: GalleryData[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return [ data, relatedData ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue