[extractor/common] Add default subtitles lang
authorSergey M․ <dstftw@gmail.com>
Wed, 19 Aug 2015 18:56:17 +0000 (00:56 +0600)
committerSergey M․ <dstftw@gmail.com>
Wed, 19 Aug 2015 18:56:17 +0000 (00:56 +0600)
youtube_dl/extractor/common.py

index ac12be93336a8b8e02c0d8cf34a572664c3bf21b..b1af4587025e56c33b38ca294a8fd50beeea9ef5 100644 (file)
@@ -1135,7 +1135,7 @@ class InfoExtractor(object):
 
         return formats
 
-    def _parse_smil_subtitles(self, smil, namespace=None):
+    def _parse_smil_subtitles(self, smil, namespace=None, subtitles_lang='en'):
         subtitles = {}
         for num, textstream in enumerate(smil.findall(self._xpath_ns('.//textstream', namespace))):
             src = textstream.get('src')
@@ -1146,7 +1146,7 @@ class InfoExtractor(object):
                 type_ = textstream.get('type')
                 if type_ == 'text/srt':
                     ext = 'srt'
-            lang = textstream.get('systemLanguage') or textstream.get('systemLanguageName')
+            lang = textstream.get('systemLanguage') or textstream.get('systemLanguageName') or subtitles_lang
             subtitles.setdefault(lang, []).append({
                 'url': src,
                 'ext': ext,