Browse Source

[zdf] Extract subtitles (closes #9081)

Jaime Marquínez Ferrándiz 9 years ago
parent
commit
8c7d6e8e22
1 changed files with 8 additions and 0 deletions
  1. 8 0
      youtube_dl/extractor/zdf.py

+ 8 - 0
youtube_dl/extractor/zdf.py

@@ -85,6 +85,13 @@ class ZDFIE(InfoExtractor):
         uploader = xpath_text(doc, './/details/originChannelTitle', 'uploader')
         uploader = xpath_text(doc, './/details/originChannelTitle', 'uploader')
         uploader_id = xpath_text(doc, './/details/originChannelId', 'uploader id')
         uploader_id = xpath_text(doc, './/details/originChannelId', 'uploader id')
         upload_date = unified_strdate(xpath_text(doc, './/details/airtime', 'upload date'))
         upload_date = unified_strdate(xpath_text(doc, './/details/airtime', 'upload date'))
+        subtitles = {}
+        captions_url = doc.find('.//caption/url')
+        if captions_url is not None:
+            subtitles['de'] = [{
+                'url': captions_url.text,
+                'ext': 'ttml',
+            }]
 
 
         def xml_to_thumbnails(fnode):
         def xml_to_thumbnails(fnode):
             thumbnails = []
             thumbnails = []
@@ -190,6 +197,7 @@ class ZDFIE(InfoExtractor):
             'uploader_id': uploader_id,
             'uploader_id': uploader_id,
             'upload_date': upload_date,
             'upload_date': upload_date,
             'formats': formats,
             'formats': formats,
+            'subtitles': subtitles,
         }
         }
 
 
     def _real_extract(self, url):
     def _real_extract(self, url):