[discoverygo] correct ttml subtitle extension
authorRemita Amine <remitamine@gmail.com>
Sat, 16 Dec 2017 11:55:20 +0000 (12:55 +0100)
committerRemita Amine <remitamine@gmail.com>
Sat, 16 Dec 2017 11:55:44 +0000 (12:55 +0100)
youtube_dl/extractor/discoverygo.py

index 99376454b2c79d61c3e53a51be2b5a4be9611f10..3368c4c075505df8a4ff03198d66a33a76f5b2f6 100644 (file)
@@ -5,6 +5,7 @@ import re
 from .common import InfoExtractor
 from ..compat import compat_str
 from ..utils import (
+    determine_ext,
     extract_attributes,
     ExtractorError,
     int_or_none,
@@ -73,7 +74,11 @@ class DiscoveryGoBaseIE(InfoExtractor):
                         not subtitle_url.startswith('http')):
                     continue
                 lang = caption.get('fileLang', 'en')
-                subtitles.setdefault(lang, []).append({'url': subtitle_url})
+                ext = determine_ext(subtitle_url)
+                subtitles.setdefault(lang, []).append({
+                    'url': subtitle_url,
+                    'ext': 'ttml' if ext == 'xml' else ext,
+                })
 
         return {
             'id': video_id,