Merge remote-tracking branch 'pulpe/moviezinese'
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 29 Apr 2014 23:37:05 +0000 (01:37 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 29 Apr 2014 23:37:05 +0000 (01:37 +0200)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/fivemin.py
youtube_dl/extractor/rtbf.py [new file with mode: 0644]
youtube_dl/extractor/scivee.py
youtube_dl/extractor/syfy.py
youtube_dl/extractor/theplatform.py

index 41018796310c97136cef68023b00cc09a2c514f1..e27cd2d2d5310d2a7889c645b6525aa0f1543125 100644 (file)
@@ -211,6 +211,7 @@ from .ringtv import RingTVIE
 from .ro220 import Ro220IE
 from .rottentomatoes import RottenTomatoesIE
 from .roxwel import RoxwelIE
+from .rtbf import RTBFIE
 from .rtlnow import RTLnowIE
 from .rts import RTSIE
 from .rtve import RTVEALaCartaIE
index b596bf587b77045c1b16bba932df3e3823b9ebef..3a50bab5c9bd04c9d176a88be080033368fe46c7 100644 (file)
@@ -6,6 +6,7 @@ from .common import InfoExtractor
 from ..utils import (
     compat_str,
     compat_urllib_parse,
+    ExtractorError,
 )
 
 
@@ -58,9 +59,17 @@ class FiveMinIE(InfoExtractor):
             'isPlayerSeed': 'true',
             'url': embed_url,
         })
-        info = self._download_json(
+        response = self._download_json(
             'https://syn.5min.com/handlers/SenseHandler.ashx?' + query,
-            video_id)['binding'][0]
+            video_id)
+        if not response['success']:
+            err_msg = response['errorMessage']
+            if err_msg == 'ErrorVideoUserNotGeo':
+                msg = 'Video not available from your location'
+            else:
+                msg = 'Aol said: %s' % err_msg
+            raise ExtractorError(msg, expected=True, video_id=video_id)
+        info = response['binding'][0]
 
         second_id = compat_str(int(video_id[:-2]) + 1)
         formats = []
diff --git a/youtube_dl/extractor/rtbf.py b/youtube_dl/extractor/rtbf.py
new file mode 100644 (file)
index 0000000..205f8a1
--- /dev/null
@@ -0,0 +1,49 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+import json
+
+from .common import InfoExtractor
+
+
+class RTBFIE(InfoExtractor):
+    _VALID_URL = r'https?://www.rtbf.be/video/[^\?]+\?id=(?P<id>\d+)'
+    _TEST = {
+        'url': 'https://www.rtbf.be/video/detail_les-diables-au-coeur-episode-2?id=1921274',
+        'md5': '799f334ddf2c0a582ba80c44655be570',
+        'info_dict': {
+            'id': '1921274',
+            'ext': 'mp4',
+            'title': 'Les Diables au coeur (épisode 2)',
+            'description': 'Football - Diables Rouges',
+            'duration': 3099,
+            'timestamp': 1398456336,
+            'upload_date': '20140425',
+        }
+    }
+
+    def _real_extract(self, url):
+        mobj = re.match(self._VALID_URL, url)
+        video_id = mobj.group('id')
+
+        page = self._download_webpage('https://www.rtbf.be/video/embed?id=%s' % video_id, video_id)
+
+        data = json.loads(self._html_search_regex(
+            r'<div class="js-player-embed" data-video="([^"]+)"', page, 'data video'))['data']
+
+        video_url = data.get('downloadUrl') or data.get('url')
+
+        if data['provider'].lower() == 'youtube':
+            return self.url_result(video_url, 'Youtube')
+
+        return {
+            'id': video_id,
+            'url': video_url,
+            'title': data['title'],
+            'description': data.get('description') or data.get('subtitle'),
+            'thumbnail': data['thumbnail']['large'],
+            'duration': data.get('duration') or data.get('realDuration'),
+            'timestamp': data['created'],
+            'view_count': data['viewCount'],
+        }
index 609a5ec994002ab17fb40f1ec970e53d1e9d3b28..33a78759a5ad37e8a6cbb6397c74317f34092385 100644 (file)
@@ -11,13 +11,17 @@ class SciVeeIE(InfoExtractor):
 
     _TEST = {
         'url': 'http://www.scivee.tv/node/62352',
-        'md5': 'b16699b74c9e6a120f6772a44960304f',
+        #'md5': 'b16699b74c9e6a120f6772a44960304f',
         'info_dict': {
             'id': '62352',
             'ext': 'mp4',
             'title': 'Adam Arkin at the 2014 DOE JGI Genomics of Energy & Environment Meeting',
             'description': 'md5:81f1710638e11a481358fab1b11059d7',
-        }
+        },
+        'params': {
+            # Range HTTP header is ignored
+            'skip_download': True,
+        },
     }
 
     def _real_extract(self, url):
index 8809a57fe31d23ea081e553302ef38222fb02221..f76b6e2b22c7fa391664218f9e59fa62908c4c08 100644 (file)
@@ -6,9 +6,9 @@ from .common import InfoExtractor
 
 
 class SyfyIE(InfoExtractor):
-    _VALID_URL = r'https?://www\.syfy\.com/videos/.+?vid:(?P<id>\d+)'
+    _VALID_URL = r'https?://www\.syfy\.com/(?:videos/.+?vid:(?P<id>[0-9]+)|(?!videos)(?P<video_name>[^/]+)(?:$|[?#]))'
 
-    _TEST = {
+    _TESTS = [{
         'url': 'http://www.syfy.com/videos/Robot%20Combat%20League/Behind%20the%20Scenes/vid:2631458',
         'md5': 'e07de1d52c7278adbb9b9b1c93a66849',
         'info_dict': {
@@ -18,10 +18,30 @@ class SyfyIE(InfoExtractor):
             'description': 'Listen to what insights George Lucas give his daughter Amanda.',
         },
         'add_ie': ['ThePlatform'],
-    }
+    }, {
+        'url': 'http://www.syfy.com/wilwheaton',
+        'md5': '94dfa54ee3ccb63295b276da08c415f6',
+        'info_dict': {
+            'id': '4yoffOOXC767',
+            'ext': 'flv',
+            'title': 'The Wil Wheaton Project - Premiering May 27th at 10/9c.',
+            'description': 'The Wil Wheaton Project premieres May 27th at 10/9c. Don\'t miss it.',
+        },
+        'add_ie': ['ThePlatform'],
+        'skip': 'Blocked outside the US',
+    }]
 
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)
-        video_id = mobj.group('id')
+        video_name = mobj.group('video_name')
+        if video_name:
+            generic_webpage = self._download_webpage(url, video_name)
+            video_id = self._search_regex(
+                r'<iframe.*?class="video_iframe_page"\s+src="/_utils/video/thP_video_controller.php.*?_vid([0-9]+)">',
+                generic_webpage, 'video ID')
+            url = 'http://www.syfy.com/videos/%s/%s/vid:%s' % (
+                video_name, video_name, video_id)
+        else:
+            video_id = mobj.group('id')
         webpage = self._download_webpage(url, video_id)
         return self.url_result(self._og_search_video_url(webpage))
index 91f2453ebf237db086f18f1ca2b30f2ce73a3728..f15780ef540d1ef39cc3526b15629004dabb73cd 100644 (file)
@@ -52,7 +52,7 @@ class ThePlatformIE(InfoExtractor):
         head = meta.find(_x('smil:head'))
         body = meta.find(_x('smil:body'))
 
-        f4m_node = body.find(_x('smil:seq/smil:video'))
+        f4m_node = body.find(_x('smil:seq//smil:video'))
         if f4m_node is not None:
             f4m_url = f4m_node.attrib['src']
             if 'manifest.f4m?' not in f4m_url: