[utils] Rework decoding of `Content-Encoding`s
authordirkf <fieldhouse@gmx.net>
Fri, 28 Jul 2023 05:03:14 +0000 (06:03 +0100)
committerdirkf <fieldhouse@gmx.net>
Sat, 29 Jul 2023 13:27:26 +0000 (14:27 +0100)
commite7926ae9f4e5fa258696551a39295402819280c9
tree979a70febc93910d6854077b8efc913aee5eca22
parent87e578c9b891b29ab6559ac81ed391897b1e1ace
[utils] Rework decoding of `Content-Encoding`s

* support nested encodings
* support optional `br` encoding, if brotli package is installed
* support optional 'compress' encoding, if ncompress package is installed
* response `Content-Encoding` has only unprocessed encodings, or removed
* response `Content-Length` is decoded length (usable for filesize metadata)
* use zlib for both deflate and gzip decompression
* some elements taken from yt-dlp: thx especially coletdjnz
test/test_http.py
youtube_dl/compat.py
youtube_dl/utils.py