]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/syfy.py
debian/patches: Removed, they came from upstream.
[youtubedl] / youtube_dl / extractor / syfy.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class SyfyIE(InfoExtractor):
9 _VALID_URL = r'https?://www\.syfy\.com/(?:videos/.+?vid:(?P<id>[0-9]+)|(?!videos)(?P<video_name>[^/]+)(?:$|[?#]))'
10
11 _TESTS = [{
12 'url': 'http://www.syfy.com/videos/Robot%20Combat%20League/Behind%20the%20Scenes/vid:2631458',
13 'info_dict': {
14 'id': 'NmqMrGnXvmO1',
15 'ext': 'flv',
16 'title': 'George Lucas has Advice for his Daughter',
17 'description': 'Listen to what insights George Lucas give his daughter Amanda.',
18 },
19 'add_ie': ['ThePlatform'],
20 }, {
21 'url': 'http://www.syfy.com/wilwheaton',
22 'md5': '94dfa54ee3ccb63295b276da08c415f6',
23 'info_dict': {
24 'id': '4yoffOOXC767',
25 'ext': 'flv',
26 'title': 'The Wil Wheaton Project - Premiering May 27th at 10/9c.',
27 'description': 'The Wil Wheaton Project premieres May 27th at 10/9c. Don\'t miss it.',
28 },
29 'add_ie': ['ThePlatform'],
30 'skip': 'Blocked outside the US',
31 }]
32
33 def _real_extract(self, url):
34 mobj = re.match(self._VALID_URL, url)
35 video_name = mobj.group('video_name')
36 if video_name:
37 generic_webpage = self._download_webpage(url, video_name)
38 video_id = self._search_regex(
39 r'<iframe.*?class="video_iframe_page"\s+src="/_utils/video/thP_video_controller.php.*?_vid([0-9]+)">',
40 generic_webpage, 'video ID')
41 url = 'http://www.syfy.com/videos/%s/%s/vid:%s' % (
42 video_name, video_name, video_id)
43 else:
44 video_id = mobj.group('id')
45 webpage = self._download_webpage(url, video_id)
46 return self.url_result(self._og_search_video_url(webpage))