A feature-rich command-line audio/video downloader
[downloader] Fix throttledratelimit The timer should not reset at start of each block
pukkandan21186af70a88
diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.pyindex 704ae6f5ad..3bc41e5b22 100644--- a/yt_dlp/downloader/http.py+++ b/yt_dlp/downloader/http.py@@ -58,6 +58,7 @@ class HttpFD(FileDownloader):ctx.block_size = self.params.get('buffersize', 1024)ctx.start_time = time.time()ctx.chunk_size = None+ throttle_start = Noneif self.params.get('continuedl', True):# Establish possible resume length@@ -197,6 +198,7 @@ class HttpFD(FileDownloader):raise RetryDownload(err)def download():+ nonlocal throttle_startdata_len = ctx.data.info().get('Content-length', None)# Range HTTP header may be ignored/unsupported by a webserver@@ -225,7 +227,6 @@ class HttpFD(FileDownloader):# measure time over whole while-loop, so slow_down() and best_block_size() work together properlynow = None # needed for slow_down() in the first loop runbefore = start # start measuring- throttle_start = Nonedef retry(e):to_stdout = ctx.tmpfilename == '-'@@ -326,7 +327,7 @@ class HttpFD(FileDownloader):if ctx.stream is not None and ctx.tmpfilename != '-':ctx.stream.close()raise ThrottledDownload()- else:+ elif speed:throttle_start = Noneif not is_test and ctx.chunk_size and ctx.data_len is not None and byte_counter < ctx.data_len: