mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 13:12:45 +01:00
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
This commit is contained in:
parent
ea5ca8e7fc
commit
af14914baa
@ -169,7 +169,7 @@ class CurlFD(ExternalFD):
|
|||||||
AVAILABLE_OPT = '-V'
|
AVAILABLE_OPT = '-V'
|
||||||
|
|
||||||
def _make_cmd(self, tmpfilename, info_dict):
|
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:
|
if info_dict.get('http_headers') is not None:
|
||||||
for key, val in info_dict['http_headers'].items():
|
for key, val in info_dict['http_headers'].items():
|
||||||
cmd += ['--header', '%s: %s' % (key, val)]
|
cmd += ['--header', '%s: %s' % (key, val)]
|
||||||
@ -219,7 +219,7 @@ class WgetFD(ExternalFD):
|
|||||||
AVAILABLE_OPT = '--version'
|
AVAILABLE_OPT = '--version'
|
||||||
|
|
||||||
def _make_cmd(self, tmpfilename, info_dict):
|
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:
|
if info_dict.get('http_headers') is not None:
|
||||||
for key, val in info_dict['http_headers'].items():
|
for key, val in info_dict['http_headers'].items():
|
||||||
cmd += ['--header', '%s: %s' % (key, val)]
|
cmd += ['--header', '%s: %s' % (key, val)]
|
||||||
|
@ -159,7 +159,6 @@ def random_user_agent():
|
|||||||
std_headers = {
|
std_headers = {
|
||||||
'User-Agent': random_user_agent(),
|
'User-Agent': random_user_agent(),
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'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',
|
'Accept-Language': 'en-us,en;q=0.5',
|
||||||
'Sec-Fetch-Mode': 'navigate',
|
'Sec-Fetch-Mode': 'navigate',
|
||||||
}
|
}
|
||||||
@ -1401,6 +1400,9 @@ def http_request(self, req):
|
|||||||
if h.capitalize() not in req.headers:
|
if h.capitalize() not in req.headers:
|
||||||
req.add_header(h, v)
|
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)
|
req.headers = handle_youtubedl_headers(req.headers)
|
||||||
|
|
||||||
if sys.version_info < (2, 7) and '#' in req.get_full_url():
|
if sys.version_info < (2, 7) and '#' in req.get_full_url():
|
||||||
|
Loading…
Reference in New Issue
Block a user