]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[dplay] Extract subtitles (Closes #9284)
authorSergey M․ <dstftw@gmail.com>
Sat, 23 Apr 2016 10:50:31 +0000 (16:50 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 23 Apr 2016 10:50:31 +0000 (16:50 +0600)
youtube_dl/extractor/dplay.py

index b2f654ca56afeeb4bb352092f6b3dbfb577e55c2..a7994697cdc1e7a447ddaf71fded416a100b78f9 100644 (file)
@@ -129,6 +129,13 @@ class DPlayIE(InfoExtractor):
 
         self._sort_formats(formats)
 
+        subtitles = {}
+        for lang in ('se', 'sv', 'da', 'nl', 'no'):
+            for format_id in ('web_vtt', 'vtt', 'srt'):
+                subtitle_url = info.get('subtitles_%s_%s' % (lang, format_id))
+                if subtitle_url:
+                    subtitles.setdefault(lang, []).append({'url': subtitle_url})
+
         return {
             'id': video_id,
             'display_id': display_id,
@@ -142,4 +149,5 @@ class DPlayIE(InfoExtractor):
             'episode_number': int_or_none(info.get('episode')),
             'age_limit': int_or_none(info.get('minimum_age')),
             'formats': formats,
+            'subtitles': subtitles,
         }