[openload] Support subtitles (closes #10625)
authorYen Chi Hsuan <yan12125@gmail.com>
Sat, 24 Sep 2016 06:27:08 +0000 (14:27 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Sat, 24 Sep 2016 06:27:08 +0000 (14:27 +0800)
ChangeLog
youtube_dl/extractor/openload.py

index ebe4ff0e86e987b1c56f8f4c68259466dce7ee95..766cc477b3cf1269c34f26307c3a19d3de7d7852 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@ vesion <unreleased>
 Core
 + Improved support for HTML5 subtitles
 
+Extractors
++ [openload] Support subtitles (#10625)
+
 
 version 2016.09.24
 
index b6e3ac25037656547974011d1dfffbf67694ad9d..4f5175136bb177f8bf21423a4f7b89fd4c29bbd8 100644 (file)
@@ -24,6 +24,22 @@ class OpenloadIE(InfoExtractor):
             'title': 'skyrim_no-audio_1080.mp4',
             'thumbnail': 're:^https?://.*\.jpg$',
         },
+    }, {
+        'url': 'https://openload.co/embed/rjC09fkPLYs',
+        'info_dict': {
+            'id': 'rjC09fkPLYs',
+            'ext': 'mp4',
+            'title': 'movie.mp4',
+            'thumbnail': 're:^https?://.*\.jpg$',
+            'subtitles': {
+                'en': [{
+                    'ext': 'vtt',
+                }],
+            },
+        },
+        'params': {
+            'skip_download': True,  # test subtitles only
+        },
     }, {
         'url': 'https://openload.co/embed/kUEfGclsU9o/skyrim_no-audio_1080.mp4',
         'only_matching': True,
@@ -71,11 +87,17 @@ class OpenloadIE(InfoExtractor):
             'title', default=None) or self._html_search_meta(
             'description', webpage, 'title', fatal=True)
 
-        return {
+        entries = self._parse_html5_media_entries(url, webpage, video_id)
+        subtitles = entries[0]['subtitles'] if entries else None
+
+        info_dict = {
             'id': video_id,
             'title': title,
             'thumbnail': self._og_search_thumbnail(webpage, default=None),
             'url': video_url,
             # Seems all videos have extensions in their titles
             'ext': determine_ext(title),
+            'subtitles': subtitles,
         }
+
+        return info_dict