Release v0.4: Add PornHub support / Server-side streaming / Plyr.js / Video srcset #96
|
@ -17,8 +17,6 @@ export const fetchPornHubVideoData = async (videoId: string, params?: FetchParam
|
|||
srcSet: []
|
||||
}
|
||||
|
||||
let related: GalleryData[] = [];
|
||||
|
||||
let mediaUrl, sessionCookie, convertedData: VideoSourceItem[]
|
||||
|
||||
let reqHeaders = getHeaders(PORNHUB_BASE_URL)
|
||||
|
@ -26,10 +24,9 @@ export const fetchPornHubVideoData = async (videoId: string, params?: FetchParam
|
|||
const queryUrl = `${PORNHUB_BASE_URL_VIDEO}${videoId.replace(/\//g, '')}`
|
||||
|
||||
const cachedVideoData = await getDataFromRedis(queryUrl)
|
||||
const cachedRelatedData = await getDataFromRedis(queryUrl + DEFAULT_RELATED_VIDEO_KEY_PATH)
|
||||
|
||||
if (cachedVideoData) {
|
||||
return [cachedVideoData as VideoData, cachedRelatedData as GalleryData[] ?? []]
|
||||
return [cachedVideoData as VideoData, []]
|
||||
}
|
||||
|
||||
await axios.get(queryUrl, reqHeaders)
|
||||
|
@ -51,14 +48,6 @@ export const fetchPornHubVideoData = async (videoId: string, params?: FetchParam
|
|||
mediaUrl = getMediaUrl
|
||||
}
|
||||
|
||||
// // populate related gallery
|
||||
// scriptTags.map((idx, elem) => {
|
||||
|
||||
// // magic goes here
|
||||
|
||||
// })
|
||||
|
||||
// await storeDataIntoRedis(queryUrl + DEFAULT_RELATED_VIDEO_KEY_PATH, related, DEFAULT_PORNHUB_VIDEO_EXPIRY);
|
||||
})
|
||||
|
||||
}).catch((error: AxiosError) => {
|
||||
|
@ -67,12 +56,10 @@ export const fetchPornHubVideoData = async (videoId: string, params?: FetchParam
|
|||
|
||||
if (sessionCookie && mediaUrl) {
|
||||
convertedData = await getPornHubMediaUrlList(mediaUrl, sessionCookie)
|
||||
await storeDataIntoRedis(queryUrl, convertedData, DEFAULT_PORNHUB_VIDEO_EXPIRY);
|
||||
|
||||
data.srcSet = convertedData.reverse()
|
||||
}
|
||||
|
||||
await storeDataIntoRedis(queryUrl, data, DEFAULT_PORNHUB_VIDEO_EXPIRY);
|
||||
}
|
||||
|
||||
return [ data, []]
|
||||
// return [ { lowResUrl: 'https://www.w3schools.com/html/mov_bbb.mp4' } ,[]]
|
||||
}
|
Loading…
Reference in New Issue