[utils] Fix getheader in urlhandle_detect_ext
authorYen Chi Hsuan <yan12125@gmail.com>
Sun, 15 May 2016 07:32:54 +0000 (15:32 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Sun, 15 May 2016 07:34:50 +0000 (15:34 +0800)
Fixes #7049, related to #9440

youtube_dl/utils.py

index a637563cb8d6562f2a626c8ee72fb9afa7ee505c..24e74428b03b4a532aeadd0a0292bb8023d17473 100644 (file)
@@ -2031,11 +2031,7 @@ def mimetype2ext(mt):
 
 
 def urlhandle_detect_ext(url_handle):
-    try:
-        url_handle.headers
-        getheader = lambda h: url_handle.headers[h]
-    except AttributeError:  # Python < 3
-        getheader = url_handle.info().getheader
+    getheader = url_handle.headers.get
 
     cd = getheader('Content-Disposition')
     if cd: