Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
zlib.error: Error -5 while decompressing data: incomplete or truncated stream #7181
Comments
remitamine
commented
Oct 15, 2015
|
(For reference, this uses the url posted in #7066) This only happens for HEAD requests because it returns no data, therefore zlib can't decompress it. This simple patch "fixes" it: diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 7dbe256..dee3b00 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -670,6 +670,9 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
@staticmethod
def deflate(data):
+ # HEAD requests produce no data, which is not a valid compressed file
+ if not data:
+ return data
try:
return zlib.decompress(data, -zlib.MAX_WBITS)
except zlib.error:Although it could be better to handle it in YoutubeDLHandler.http_response. |
|
How do I apply this "fix"? @jaimeMF |