aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-02-19 00:31:01 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-02-19 00:31:01 +0100
commitc460bdd56b0420bb5175344c0f6523675fdae415 (patch)
treefa55a47d2f4b4d8432f65a6d11602076f211414c /youtube_dl/utils.py
parentb81a359eb67aea83799f1306a441fd6163bf1840 (diff)
downloadyoutube-dl-c460bdd56b0420bb5175344c0f6523675fdae415.tar.xz
[sandia] Add new extractor (#4974)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 4358137a0..238b6556b 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1616,6 +1616,15 @@ def args_to_str(args):
return ' '.join(shlex_quote(a) for a in args)
+def mimetype2ext(mt):
+ _, _, res = mt.rpartition('/')
+
+ return {
+ 'x-ms-wmv': 'wmv',
+ 'x-mp4-fragmented': 'mp4',
+ }.get(res, res)
+
+
def urlhandle_detect_ext(url_handle):
try:
url_handle.headers
@@ -1631,7 +1640,7 @@ def urlhandle_detect_ext(url_handle):
if e:
return e
- return getheader('Content-Type').split("/")[1]
+ return mimetype2ext(getheader('Content-Type'))
def age_restricted(content_limit, age_limit):