diff options
author | dirkf <[email protected]> | 2023-07-30 21:50:52 +0100 |
---|---|---|
committer | dirkf <[email protected]> | 2023-08-01 01:05:09 +0100 |
commit | 2efc8de4d2299e08e0c84d674d7fc7f3fa669487 (patch) | |
tree | 159867ace643fd2118cf0d75fc65cb243c1c8d77 /youtube_dl | |
parent | e4178b5af3428f29feca622d531090f10f54af35 (diff) | |
download | youtube-dl-2efc8de4d2299e08e0c84d674d7fc7f3fa669487.tar.gz youtube-dl-2efc8de4d2299e08e0c84d674d7fc7f3fa669487.zip |
[utils] Advertise optional supported `Content-Encoding`s
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index c530ed5a2..81ff78807 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1678,9 +1678,7 @@ def random_user_agent(): std_headers = { 'User-Agent': random_user_agent(), - 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-us,en;q=0.5', } @@ -2724,6 +2722,13 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler): if h.capitalize() not in req.headers: req.add_header(h, v) + # Similarly, 'Accept-encoding' + if 'Accept-encoding' not in req.headers: + req.add_header( + 'Accept-Encoding', join_nonempty( + 'gzip', 'deflate', brotli and 'br', ncompress and 'compress', + delim=', ')) + req.headers = handle_youtubedl_headers(req.headers) if sys.version_info < (2, 7): |