Spotify support added

This commit is contained in:
killer069
2021-09-05 18:50:57 +05:30
parent 2a84dceda6
commit 4179557fde
14 changed files with 609 additions and 203 deletions

View File

@@ -40,7 +40,7 @@ export async function stream(url : string, cookie? : string): Promise<Stream | L
let final: any[] = [];
let type : StreamType;
if(info.LiveStreamData.isLive === true && info.LiveStreamData.hlsManifestUrl !== null && info.video_details.durationInSec === '0') {
return live_stream(info as InfoData)
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
}
let response = await got(info.format[info.format.length - 1].url, {
@@ -76,7 +76,7 @@ export async function stream_from_info(info : InfoData): Promise<Stream | LiveSt
let final: any[] = [];
let type : StreamType;
if(info.LiveStreamData.isLive === true && info.LiveStreamData.hlsManifestUrl !== null && info.video_details.durationInSec === '0') {
return live_stream(info as InfoData)
return new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
}
let response = await got(info.format[info.format.length - 1].url, {
@@ -115,8 +115,3 @@ function filterFormat(formats : any[], codec : string){
})
return result
}
function live_stream(info : InfoData): LiveStreaming{
let stream = new LiveStreaming(info.LiveStreamData.dashManifestUrl, info.format[info.format.length - 1].targetDurationSec, info.video_details.url)
return stream
}