summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-30 04:52:50 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-30 04:52:50 +0100
commit975fa541c204860e25ba5eff330ff85a77eee777 (patch)
tree2c2790b5597aa9f288cf04e5f335b029bc5b3e82
parent251974e44cf3a79fb656fdf290d989d73851642f (diff)
downloadyoutube-dl-975fa541c204860e25ba5eff330ff85a77eee777.tar.gz
youtube-dl-975fa541c204860e25ba5eff330ff85a77eee777.tar.xz
youtube-dl-975fa541c204860e25ba5eff330ff85a77eee777.zip
[liveleak] Support multiple formats (Fixes #2262)
-rw-r--r--youtube_dl/extractor/liveleak.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/youtube_dl/extractor/liveleak.py b/youtube_dl/extractor/liveleak.py
index d01fd01e3..a571fa742 100644
--- a/youtube_dl/extractor/liveleak.py
+++ b/youtube_dl/extractor/liveleak.py
@@ -1,5 +1,6 @@
 from __future__ import unicode_literals
 
+import json
 import re
 
 from .common import InfoExtractor
@@ -26,8 +27,16 @@ class LiveLeakIE(InfoExtractor):
 
         video_id = mobj.group('video_id')
         webpage = self._download_webpage(url, video_id)
-        video_url = self._search_regex(
-            r'file: "(.*?)",', webpage, 'video URL')
+        sources_raw = self._search_regex(
+            r'(?s)sources:\s*(\[.*?\]),', webpage, 'video URLs')
+        sources_json = re.sub(r'\s([a-z]+):\s', r'"\1": ', sources_raw)
+        sources = json.loads(sources_json)
+
+        formats = [{
+            'format_note': s.get('label'),
+            'url': s['file'],
+        } for s in sources]
+        self._sort_formats(formats)
 
         video_title = self._og_search_title(webpage).replace('LiveLeak.com -', '').strip()
         video_description = self._og_search_description(webpage)
@@ -36,9 +45,8 @@ class LiveLeakIE(InfoExtractor):
 
         return {
             'id': video_id,
-            'url': video_url,
-            'ext': 'mp4',
             'title': video_title,
             'description': video_description,
-            'uploader': video_uploader
+            'uploader': video_uploader,
+            'formats': formats,
         }