Release v0.4.0 #110
|
@ -24,7 +24,7 @@ export default async function VideoPage({ params }: { params: { platform: Platfo
|
||||||
|
|
||||||
const [data, related] = await new VideoAgent(platform).getVideo(decodedId)
|
const [data, related] = await new VideoAgent(platform).getVideo(decodedId)
|
||||||
|
|
||||||
if (!data.lowResUrl && (!data.srcSet || data.srcSet.length == 0)) {
|
if (!data.hlsUrl && (!data.srcSet || data.srcSet.length == 0)) {
|
||||||
redirect(`/${locale}/404`)
|
redirect(`/${locale}/404`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ const VideoJS: React.FC<Props> = (props) => {
|
||||||
|
|
||||||
const { data } = props;
|
const { data } = props;
|
||||||
|
|
||||||
const videoSrc = data.hlsUrl ?? data.lowResUrl
|
const videoSrc = data.hlsUrl
|
||||||
const videoType = data.hlsUrl ? 'application/x-mpegURL' : 'video/mp4'
|
const videoType = 'application/x-mpegURL'
|
||||||
|
|
||||||
const playerRef = React.useRef(null);
|
const playerRef = React.useRef(null);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import Results from '@/components/Layout/Results';
|
||||||
import { GalleryData, VideoData } from '@/meta/data';
|
import { GalleryData, VideoData } from '@/meta/data';
|
||||||
import { Platforms } from '@/meta/settings';
|
import { Platforms } from '@/meta/settings';
|
||||||
import Disclaimer from '@/components/Layout/Header/Disclaimer';
|
import Disclaimer from '@/components/Layout/Header/Disclaimer';
|
||||||
import { platform } from 'os';
|
|
||||||
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -29,7 +28,7 @@ const Video: React.FC<Props> = (props) => {
|
||||||
<>
|
<>
|
||||||
<Header />
|
<Header />
|
||||||
<Disclaimer platform={platform} />
|
<Disclaimer platform={platform} />
|
||||||
{data.srcSet ? <PlyrJS data={data} /> : <VideoJS data={data} />}
|
{data.hlsUrl ? <VideoJS data={data} /> : <PlyrJS data={data} />}
|
||||||
<SearchBar />
|
<SearchBar />
|
||||||
{related && <Results data={related} />}
|
{related && <Results data={related} />}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -19,8 +19,6 @@ export interface VideoSourceItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VideoData {
|
export interface VideoData {
|
||||||
lowResUrl?: string,
|
|
||||||
hiResUrl?: string,
|
|
||||||
hlsUrl?: string
|
hlsUrl?: string
|
||||||
srcSet?: VideoSourceItem[]
|
srcSet?: VideoSourceItem[]
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { getPornHubMediaUrlList, getPornHubRelatedVideoData } from "./url";
|
||||||
export const fetchPornHubVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
export const fetchPornHubVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
||||||
|
|
||||||
let data: VideoData = {
|
let data: VideoData = {
|
||||||
lowResUrl: '',
|
hlsUrl: '',
|
||||||
srcSet: []
|
srcSet: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ import { getDataFromRedis, storeDataIntoRedis } from '@/redis/client';
|
||||||
export const fetchXNXXVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
export const fetchXNXXVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
||||||
|
|
||||||
let data: VideoData = {
|
let data: VideoData = {
|
||||||
lowResUrl: ''
|
hlsUrl: '',
|
||||||
|
srcSet: []
|
||||||
}
|
}
|
||||||
|
|
||||||
let related: GalleryData[] = [];
|
let related: GalleryData[] = [];
|
||||||
|
@ -50,11 +51,19 @@ export const fetchXNXXVideoData = async (videoId: string, params?: FetchParams):
|
||||||
const hlsUrl = findVideoUrlInsideTagStringByFunctionNameAndExtension($(elem).toString(), 'setVideoHLS', '.m3u8')
|
const hlsUrl = findVideoUrlInsideTagStringByFunctionNameAndExtension($(elem).toString(), 'setVideoHLS', '.m3u8')
|
||||||
|
|
||||||
if (lowResUrl) {
|
if (lowResUrl) {
|
||||||
data.lowResUrl = lowResUrl;
|
data.srcSet?.push({
|
||||||
|
src: lowResUrl,
|
||||||
|
type: 'video/mp4',
|
||||||
|
size: "480"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hiResUrl) {
|
if (hiResUrl) {
|
||||||
data.hiResUrl = hiResUrl
|
data.srcSet?.push({
|
||||||
|
src: hiResUrl,
|
||||||
|
type: 'video/mp4',
|
||||||
|
size: "720"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hlsUrl) {
|
if (hlsUrl) {
|
||||||
|
|
|
@ -14,7 +14,8 @@ import { DEFAULT_RELATED_VIDEO_KEY_PATH, DEFAULT_XVIDEOS_CONTENT_EXPIRY } from '
|
||||||
export const fetchXvideosVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
export const fetchXvideosVideoData = async (videoId: string, params?: FetchParams): Promise<[VideoData, GalleryData[]]> => {
|
||||||
|
|
||||||
let data: VideoData = {
|
let data: VideoData = {
|
||||||
lowResUrl: ''
|
hlsUrl: '',
|
||||||
|
srcSet: []
|
||||||
}
|
}
|
||||||
|
|
||||||
let related: GalleryData[] = [];
|
let related: GalleryData[] = [];
|
||||||
|
@ -50,11 +51,19 @@ export const fetchXvideosVideoData = async (videoId: string, params?: FetchParam
|
||||||
const hlsUrl = findVideoUrlInsideTagStringByFunctionNameAndExtension($(elem).toString(), 'setVideoHLS', '.m3u8')
|
const hlsUrl = findVideoUrlInsideTagStringByFunctionNameAndExtension($(elem).toString(), 'setVideoHLS', '.m3u8')
|
||||||
|
|
||||||
if (lowResUrl) {
|
if (lowResUrl) {
|
||||||
data.lowResUrl = lowResUrl;
|
data.srcSet?.push({
|
||||||
|
src: lowResUrl,
|
||||||
|
type: 'video/mp4',
|
||||||
|
size: "480"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hiResUrl) {
|
if (hiResUrl) {
|
||||||
data.hiResUrl = hiResUrl
|
data.srcSet?.push({
|
||||||
|
src: hiResUrl,
|
||||||
|
type: 'video/mp4',
|
||||||
|
size: "720"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hlsUrl) {
|
if (hlsUrl) {
|
||||||
|
|
Loading…
Reference in New Issue