summary refs log tree commit diff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-05-21 13:15:28 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-05-21 13:15:28 +0800
commit16da9bbc29b76b6e6e1a6134a17e9f25d91296c8 (patch)
tree28c8ef432ab4dac816243d80ea6ed7a5433e3920
parentc8602b2f9bcdda00398b2c54db4c1be85b75ce39 (diff)
downloadyoutube-dl-16da9bbc29b76b6e6e1a6134a17e9f25d91296c8.tar.gz
youtube-dl-16da9bbc29b76b6e6e1a6134a17e9f25d91296c8.tar.xz
youtube-dl-16da9bbc29b76b6e6e1a6134a17e9f25d91296c8.zip
[common] Add _m3u8_meta_format() template
For extractors who handle m3u8 manifests by themselves. (eg., AnvatoIE)

Part of #9522
-rw-r--r--youtube_dl/extractor/common.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 9f22ee930..17e866f91 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -1058,12 +1058,8 @@ class InfoExtractor(object):
             })
         return formats
 
-    def _extract_m3u8_formats(self, m3u8_url, video_id, ext=None,
-                              entry_protocol='m3u8', preference=None,
-                              m3u8_id=None, note=None, errnote=None,
-                              fatal=True, live=False):
-
-        formats = [{
+    def _m3u8_meta_format(self, m3u8_url, ext=None, preference=None, m3u8_id=None):
+        return {
             'format_id': '-'.join(filter(None, [m3u8_id, 'meta'])),
             'url': m3u8_url,
             'ext': ext,
@@ -1071,7 +1067,14 @@ class InfoExtractor(object):
             'preference': preference - 1 if preference else -1,
             'resolution': 'multiple',
             'format_note': 'Quality selection URL',
-        }]
+        }
+
+    def _extract_m3u8_formats(self, m3u8_url, video_id, ext=None,
+                              entry_protocol='m3u8', preference=None,
+                              m3u8_id=None, note=None, errnote=None,
+                              fatal=True, live=False):
+
+        formats = [self._m3u8_meta_format(m3u8_url, ext, preference, m3u8_id)]
 
         format_url = lambda u: (
             u