diff options
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
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<filename>[^"]+)"', cd) + if m: + e = determine_ext(m.group('filename'), default_ext=None) + if e: + return e + return getheader('Content-Type').split("/")[1] |