From 90585192824dd3e6bad8b2ffdc5002f6161a9e55 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Mon, 30 Aug 2021 23:54:34 +0530 Subject: [PATCH] Headers added --- play-dl/YouTube/stream.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/play-dl/YouTube/stream.ts b/play-dl/YouTube/stream.ts index 5e93f06..baa4a8f 100644 --- a/play-dl/YouTube/stream.ts +++ b/play-dl/YouTube/stream.ts @@ -44,7 +44,11 @@ export async function stream(url : string, error_check : boolean = false): Promi } if(error_check){ - let response = await got(info.format[info.format.length - 1].url) + let response = await got(info.format[info.format.length - 1].url, { + headers : { + "range" : `bytes=0-1` + } + }) if(response.statusCode >= 400){ return await stream(info.video_details.url, true) } @@ -78,7 +82,11 @@ export async function stream_from_info(info : InfoData, error_check : boolean = } if(error_check){ - let response = await got(info.format[info.format.length - 1].url) + let response = await got(info.format[info.format.length - 1].url, { + headers : { + "range" : `bytes=0-1` + } + }) if(response.statusCode >= 400){ return await stream(info.video_details.url, true) }