1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 19:36:18 -04: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:
coletdev
2022-03-23 20:47:02 +13:00
committed by GitHub
parent ea5ca8e7fc
commit af14914baa
2 changed files with 5 additions and 3 deletions

View File

@@ -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():