X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Futils.py;h=764474c3301695f77b6421b67b745d3c157d0937;hb=73e449b226ddfe204fb9f9bea5514141624abbf4;hp=7832ed87f022d5c4891cecb43822ebebd30a6d0b;hpb=9d22a7dfb07ad6ff23680e11238744b2bb1735aa;p=youtube-dl diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 7832ed87f..764474c33 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1612,6 +1612,14 @@ def urlhandle_detect_ext(url_handle): except AttributeError: # Python < 3 getheader = url_handle.info().getheader + cd = getheader('Content-Disposition') + if cd: + m = re.match(r'attachment;\s*filename="(?P[^"]+)"', cd) + if m: + e = determine_ext(m.group('filename'), default_ext=None) + if e: + return e + return getheader('Content-Type').split("/")[1]