]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videopremium.py
   1 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   9 class VideoPremiumIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'https?://(?:www\.)?videopremium\.(?:tv|me)/(?P<id>\w+)(?:/.*)?' 
  12         'url': 'http://videopremium.tv/4w7oadjsf156', 
  16             'title': 'youtube-dl_test_video____a_________-BaW_jenozKc.mp4.mp4' 
  19             'skip_download': True, 
  21         'skip': 'Test file has been deleted.', 
  24     def _real_extract(self
, url
): 
  25         video_id 
= self
._match
_id
(url
) 
  26         webpage_url 
= 'http://videopremium.tv/' + video_id
 
  27         webpage 
= self
._download
_webpage
(webpage_url
, video_id
) 
  29         if re
.match(r
'^<html><head><script[^>]*>window\.location\s*=', webpage
): 
  30             # Download again, we need a cookie 
  31             webpage 
= self
._download
_webpage
( 
  32                 webpage_url
, video_id
, 
  33                 note
='Downloading webpage again (with cookie)') 
  35         video_title 
= self
._html
_search
_regex
( 
  36             r
'<h2(?:.*?)>\s*(.+?)\s*<', webpage
, 'video title') 
  40             'url': 'rtmp://e%d.md.iplay.md/play' % random
.randint(1, 16), 
  41             'play_path': 'mp4:%s.f4v' % video_id
, 
  42             'page_url': 'http://videopremium.tv/' + video_id
, 
  43             'player_url': 'http://videopremium.tv/uplayer/uppod.swf',