mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
Fully https working
This commit is contained in:
@@ -41,16 +41,6 @@ export async function stream(url : string, cookie? : string): Promise<Stream | L
|
||||
if(info.LiveStreamData.isLive === true && info.LiveStreamData.hlsManifestUrl !== null && info.video_details.durationInSec === '0') {
|
||||
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
|
||||
}
|
||||
let resp = await request(info.format[info.format.length - 1].url, {
|
||||
headers : {
|
||||
"range" : `bytes=0-1`
|
||||
},
|
||||
}).catch(() => {
|
||||
return 0
|
||||
})
|
||||
if(resp === 0){
|
||||
return await stream(info.video_details.url, cookie)
|
||||
}
|
||||
|
||||
let audioFormat = parseAudioFormats(info.format)
|
||||
let opusFormats = filterFormat(audioFormat, "opus")
|
||||
@@ -69,7 +59,7 @@ export async function stream(url : string, cookie? : string): Promise<Stream | L
|
||||
final.push(info.format[info.format.length - 1])
|
||||
}
|
||||
|
||||
return new Stream(final[0].url, type, info.video_details.durationInSec, Number(final[0].contentLength))
|
||||
return new Stream(final[0].url, type, info.video_details.durationInSec, Number(final[0].contentLength), info.video_details.url, cookie as string)
|
||||
}
|
||||
|
||||
export async function stream_from_info(info : InfoData, cookie? : string): Promise<Stream | LiveStreaming>{
|
||||
@@ -79,17 +69,6 @@ export async function stream_from_info(info : InfoData, cookie? : string): Promi
|
||||
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
|
||||
}
|
||||
|
||||
let resp = await request(info.format[info.format.length - 1].url, {
|
||||
headers : {
|
||||
"range" : `bytes=0-1`
|
||||
},
|
||||
}).catch(() => {
|
||||
return 0
|
||||
})
|
||||
if(resp === 0){
|
||||
return await stream(info.video_details.url, cookie)
|
||||
}
|
||||
|
||||
let audioFormat = parseAudioFormats(info.format)
|
||||
let opusFormats = filterFormat(audioFormat, "opus")
|
||||
|
||||
@@ -107,7 +86,7 @@ export async function stream_from_info(info : InfoData, cookie? : string): Promi
|
||||
final.push(info.format[info.format.length - 1])
|
||||
}
|
||||
|
||||
return new Stream(final[0].url, type, info.video_details.durationInSec, Number(final[0].contentLength))
|
||||
return new Stream(final[0].url, type, info.video_details.durationInSec, Number(final[0].contentLength), info.video_details.url, cookie as string)
|
||||
}
|
||||
|
||||
function filterFormat(formats : any[], codec : string){
|
||||
|
||||
Reference in New Issue
Block a user