[extractor/common] Add more subtitle mime types for guess when ext is missing
authorSergey M․ <dstftw@gmail.com>
Wed, 19 Aug 2015 19:02:50 +0000 (01:02 +0600)
committerSergey M․ <dstftw@gmail.com>
Wed, 19 Aug 2015 19:02:50 +0000 (01:02 +0600)
youtube_dl/extractor/common.py

index b1af4587025e56c33b38ca294a8fd50beeea9ef5..ce2030d28264eb33b53571c0e53ef24ddac09502 100644 (file)
@@ -1144,8 +1144,13 @@ class InfoExtractor(object):
             ext = textstream.get('ext') or determine_ext(src)
             if not ext:
                 type_ = textstream.get('type')
-                if type_ == 'text/srt':
-                    ext = 'srt'
+                SUBTITLES_TYPES = {
+                    'text/vtt': 'vtt',
+                    'text/srt': 'srt',
+                    'application/smptett+xml': 'tt',
+                }
+                if type_ in SUBTITLES_TYPES:
+                    ext = SUBTITLES_TYPES[type_]
             lang = textstream.get('systemLanguage') or textstream.get('systemLanguageName') or subtitles_lang
             subtitles.setdefault(lang, []).append({
                 'url': src,