瀏覽代碼

[utils] Fix getheader in urlhandle_detect_ext

Fixes #7049, related to #9440
Yen Chi Hsuan 9 年之前
父節點
當前提交
79298173c5
共有 1 個文件被更改,包括 1 次插入5 次删除
  1. 1 5
      youtube_dl/utils.py

+ 1 - 5
youtube_dl/utils.py

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