]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[daisuki] Add subtitles (#4738)
authorYen Chi Hsuan <yan12125@gmail.com>
Tue, 28 Feb 2017 14:29:01 +0000 (22:29 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Tue, 28 Feb 2017 14:29:01 +0000 (22:29 +0800)
youtube_dl/extractor/daisuki.py

index 6fd09faf1db70c6c9afab3c482a00fb7e8314568..58cc986666c26466a6a67b971369e1fd6b987514 100644 (file)
@@ -34,6 +34,11 @@ class DaisukiIE(InfoExtractor):
             'id': '11213',
             'ext': 'mp4',
             'title': '#01 Who is in the pumpkin carriage? - THE IDOLM@STER CINDERELLA GIRLS',
+            'subtitles': {
+                'mul': [{
+                    'ext': 'ttml',
+                }],
+            },
             'creator': 'BANDAI NAMCO Entertainment',
         },
         'params': {
@@ -101,10 +106,20 @@ class DaisukiIE(InfoExtractor):
         creator = self._html_search_regex(
             r'Creator\s*:\s*([^<]+)', webpage, 'creator', fatal=False)
 
+        subtitles = {}
+        caption_url = rtn.get('caption_url')
+        if caption_url:
+            # mul: multiple languages
+            subtitles['mul'] = [{
+                'url': caption_url,
+                'ext': 'ttml',
+            }]
+
         return {
             'id': video_id,
             'title': title,
             'formats': formats,
+            'subtitles': subtitles,
             'creator': creator,
         }