]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Merge remote-tracking branch 'akirk/ellentv'
authorPhilipp Hagemeister <phihag@phihag.de>
Fri, 15 Aug 2014 08:55:54 +0000 (10:55 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Fri, 15 Aug 2014 08:55:54 +0000 (10:55 +0200)
Makefile
youtube_dl/extractor/livestream.py
youtube_dl/extractor/shared.py

index c079761efa9b2e60887575f4cd7626d0abe469a2..088a9320bddfd367babd928bc96c71f3eaa4d9de 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,10 +6,10 @@ clean:
 cleanall: clean
        rm -f youtube-dl youtube-dl.exe
 
-PREFIX=/usr/local
-BINDIR=$(PREFIX)/bin
-MANDIR=$(PREFIX)/man
-PYTHON=/usr/bin/env python
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/man
+PYTHON ?= /usr/bin/env python
 
 # set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
 ifeq ($(PREFIX),/usr)
index c0c2d9b09d92c8ce79894112fd58834f0f1b92a1..281a0ce4052eb986d7d4df6d10b8c29b36cab6d5 100644 (file)
@@ -111,17 +111,28 @@ class LivestreamIE(InfoExtractor):
         event_name = mobj.group('event_name')
         webpage = self._download_webpage(url, video_id or event_name)
 
-        if video_id is None:
-            # This is an event page:
+        og_video = self._og_search_video_url(webpage, 'player url', fatal=False, default=None)
+        if og_video is None:
             config_json = self._search_regex(
                 r'window.config = ({.*?});', webpage, 'window config')
             info = json.loads(config_json)['event']
+
+            def is_relevant(vdata, vid):
+                result = vdata['type'] == 'video'
+                if video_id is not None:
+                    result = result and compat_str(vdata['data']['id']) == vid
+                return result
+
             videos = [self._extract_video_info(video_data['data'])
-                for video_data in info['feed']['data']
-                if video_data['type'] == 'video']
-            return self.playlist_result(videos, info['id'], info['full_name'])
+                      for video_data in info['feed']['data']
+                      if is_relevant(video_data, video_id)]
+            if video_id is None:
+                # This is an event page:
+                return self.playlist_result(videos, info['id'], info['full_name'])
+            else:
+                if videos:
+                    return videos[0]
         else:
-            og_video = self._og_search_video_url(webpage, 'player url')
             query_str = compat_urllib_parse_urlparse(og_video).query
             query = compat_urlparse.parse_qs(query_str)
             api_url = query['play_url'][0].replace('.smil', '')
index 8607482be8b318fa2772fcb3cd882c9359f50cf9..badba2ac61ca5f46db325e5064f6e75425c60cbb 100644 (file)
@@ -17,11 +17,11 @@ class SharedIE(InfoExtractor):
 
     _TEST = {
         'url': 'http://shared.sx/0060718775',
-        'md5': '53e1c58fc3e777ae1dfe9e57ba2f9c72',
+        'md5': '106fefed92a8a2adb8c98e6a0652f49b',
         'info_dict': {
             'id': '0060718775',
             'ext': 'mp4',
-            'title': 'Big Buck Bunny Trailer',
+            'title': 'Bmp4',
         },
     }