aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-01-22 12:04:07 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-01-22 12:04:13 +0100
commitb55ee18ff3a9642fe25a977e1152472877294493 (patch)
tree7b7134729d44552b4156b6e904067e6e20b33ddc /youtube_dl/utils.py
parente5763a7a7e630cfd94b8993a9592cb3243890e0c (diff)
[hearthisat] Add support for more high-quality download links
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py8
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]