mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
https Feature added
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import got from "got/dist/source"
|
||||
import { video_info } from "."
|
||||
import { LiveStreaming, Stream } from "./classes/LiveStream"
|
||||
import { request } from "./utils/request"
|
||||
|
||||
export enum StreamType{
|
||||
Arbitrary = 'arbitrary',
|
||||
@@ -41,18 +41,16 @@ 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 got(info.format[info.format.length - 1].url, {
|
||||
let resp = await request(info.format[info.format.length - 1].url, {
|
||||
headers : {
|
||||
"range" : `bytes=0-1`
|
||||
},
|
||||
retry : 0
|
||||
}).catch(() => {
|
||||
return 0
|
||||
})
|
||||
if(resp === 0){
|
||||
return await stream(info.video_details.url, cookie)
|
||||
}
|
||||
else if(typeof resp !== "number") resp.destroy()
|
||||
|
||||
let audioFormat = parseAudioFormats(info.format)
|
||||
let opusFormats = filterFormat(audioFormat, "opus")
|
||||
@@ -81,18 +79,16 @@ 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 got(info.format[info.format.length - 1].url, {
|
||||
let resp = await request(info.format[info.format.length - 1].url, {
|
||||
headers : {
|
||||
"range" : `bytes=0-1`
|
||||
},
|
||||
retry : 0
|
||||
}).catch(() => {
|
||||
return 0
|
||||
})
|
||||
if(resp === 0){
|
||||
return await stream(info.video_details.url, cookie)
|
||||
}
|
||||
else if(typeof resp !== "number") resp.destroy()
|
||||
|
||||
let audioFormat = parseAudioFormats(info.format)
|
||||
let opusFormats = filterFormat(audioFormat, "opus")
|
||||
|
||||
Reference in New Issue
Block a user