diff options
author | Felix Yan <felixonmars@archlinux.org> | 2023-02-17 05:08:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-17 08:38:45 +0530 |
commit | 65e5c021e7c5f23ecbc6a982b72a02ac6cd6900d (patch) | |
tree | 91a6617854976065e04a49a2f8be10df801f4de2 /yt_dlp/downloader/http.py | |
parent | a9189510baadf0dccd2d4d363bc6f3a441128bb0 (diff) | |
download | hypervideo-pre-65e5c021e7c5f23ecbc6a982b72a02ac6cd6900d.tar.lz hypervideo-pre-65e5c021e7c5f23ecbc6a982b72a02ac6cd6900d.tar.xz hypervideo-pre-65e5c021e7c5f23ecbc6a982b72a02ac6cd6900d.zip |
[utils] Don't use Content-length with encoding (#6176)
Authored by: felixonmars
Closes #3772, #6178
Diffstat (limited to 'yt_dlp/downloader/http.py')
-rw-r--r-- | yt_dlp/downloader/http.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.py index 95c870ee8..fa72d5722 100644 --- a/yt_dlp/downloader/http.py +++ b/yt_dlp/downloader/http.py @@ -211,7 +211,12 @@ class HttpFD(FileDownloader): ctx.stream = None def download(): - data_len = ctx.data.info().get('Content-length', None) + data_len = ctx.data.info().get('Content-length') + + if ctx.data.info().get('Content-encoding'): + # Content-encoding is present, Content-length is not reliable anymore as we are + # doing auto decompression. (See: https://github.com/yt-dlp/yt-dlp/pull/6176) + data_len = None # Range HTTP header may be ignored/unsupported by a webserver # (e.g. extractor/scivee.py, extractor/bambuser.py). |