]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/syfy.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class SyfyIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://www\.syfy\.com/(?:videos/.+?vid:(?P<id>[0-9]+)|(?!videos)(?P<video_name>[^/]+)(?:$|[?#]))' 
  12         'url': 'http://www.syfy.com/videos/Robot%20Combat%20League/Behind%20the%20Scenes/vid:2631458', 
  13         'md5': 'e07de1d52c7278adbb9b9b1c93a66849', 
  17             'title': 'George Lucas has Advice for his Daughter', 
  18             'description': 'Listen to what insights George Lucas give his daughter Amanda.', 
  20         'add_ie': ['ThePlatform'], 
  22         'url': 'http://www.syfy.com/wilwheaton', 
  23         'md5': '94dfa54ee3ccb63295b276da08c415f6', 
  27             'title': 'The Wil Wheaton Project - Premiering May 27th at 10/9c.', 
  28             'description': 'The Wil Wheaton Project premieres May 27th at 10/9c. Don\'t miss it.', 
  30         'add_ie': ['ThePlatform'], 
  31         'skip': 'Blocked outside the US', 
  34     def _real_extract(self
, url
): 
  35         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  36         video_name 
= mobj
.group('video_name') 
  38             generic_webpage 
= self
._download
_webpage
(url
, video_name
) 
  39             video_id 
= self
._search
_regex
( 
  40                 r
'<iframe.*?class="video_iframe_page"\s+src="/_utils/video/thP_video_controller.php.*?_vid([0-9]+)">', 
  41                 generic_webpage
, 'video ID') 
  42             url 
= 'http://www.syfy.com/videos/%s/%s/vid:%s' % ( 
  43                 video_name
, video_name
, video_id
) 
  45             video_id 
= mobj
.group('id') 
  46         webpage 
= self
._download
_webpage
(url
, video_id
) 
  47         return self
.url_result(self
._og
_search
_video
_url
(webpage
))