diff options
author | coletdev <coletdjnz@protonmail.com> | 2022-03-23 20:47:02 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 07:47:02 +0000 |
commit | af14914baac50c7969bfd4fd9741cb5f4250c0e7 (patch) | |
tree | 5e1ec09cbbbdcc6bda83a8f38a4600a3a09c2471 | |
parent | ea5ca8e7fcf348a40e3eda70738738739123bded (diff) | |
download | hypervideo-pre-af14914baac50c7969bfd4fd9741cb5f4250c0e7.tar.lz hypervideo-pre-af14914baac50c7969bfd4fd9741cb5f4250c0e7.tar.xz hypervideo-pre-af14914baac50c7969bfd4fd9741cb5f4250c0e7.zip |
Remove `Accept-Encoding` header from `std_headers` (#3153)
This should be set by each downloader to what it supports.
Fixes https://github.com/yt-dlp/yt-dlp/issues/3142
Authored-by: coletdjnz
-rw-r--r-- | yt_dlp/downloader/external.py | 4 | ||||
-rw-r--r-- | yt_dlp/utils.py | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py index cfa646ebc..c900b3842 100644 --- a/yt_dlp/downloader/external.py +++ b/yt_dlp/downloader/external.py @@ -169,7 +169,7 @@ class CurlFD(ExternalFD): AVAILABLE_OPT = '-V' def _make_cmd(self, tmpfilename, info_dict): - cmd = [self.exe, '--location', '-o', tmpfilename] + cmd = [self.exe, '--location', '-o', tmpfilename, '--compressed'] if info_dict.get('http_headers') is not None: for key, val in info_dict['http_headers'].items(): cmd += ['--header', '%s: %s' % (key, val)] @@ -219,7 +219,7 @@ class WgetFD(ExternalFD): AVAILABLE_OPT = '--version' def _make_cmd(self, tmpfilename, info_dict): - cmd = [self.exe, '-O', tmpfilename, '-nv', '--no-cookies'] + cmd = [self.exe, '-O', tmpfilename, '-nv', '--no-cookies', '--compression=auto'] if info_dict.get('http_headers') is not None: for key, val in info_dict['http_headers'].items(): cmd += ['--header', '%s: %s' % (key, val)] diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index a08dc3c11..c71a7b833 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -159,7 +159,6 @@ if compat_brotli: std_headers = { 'User-Agent': random_user_agent(), 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'Accept-Encoding': ', '.join(SUPPORTED_ENCODINGS), 'Accept-Language': 'en-us,en;q=0.5', 'Sec-Fetch-Mode': 'navigate', } @@ -1401,6 +1400,9 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler): if h.capitalize() not in req.headers: req.add_header(h, v) + if 'Accept-encoding' not in req.headers: + req.add_header('Accept-encoding', ', '.join(SUPPORTED_ENCODINGS)) + req.headers = handle_youtubedl_headers(req.headers) if sys.version_info < (2, 7) and '#' in req.get_full_url(): |