]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videomega.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import sanitized_Request
 
  10 class VideoMegaIE(InfoExtractor
): 
  12     _VALID_URL 
= r
'(?:videomega:|https?://(?:www\.)?videomega\.tv/(?:(?:view|iframe|cdn)\.php)?\?ref=)(?P<id>[A-Za-z0-9]+)' 
  14         'url': 'http://videomega.tv/cdn.php?ref=AOSQBJYKIDDIKYJBQSOA', 
  15         'md5': 'cc1920a58add3f05c6a93285b84fb3aa', 
  17             'id': 'AOSQBJYKIDDIKYJBQSOA', 
  20             'thumbnail': 're:^https?://.*\.jpg$', 
  23         'url': 'http://videomega.tv/cdn.php?ref=AOSQBJYKIDDIKYJBQSOA&width=1070&height=600', 
  24         'only_matching': True, 
  26         'url': 'http://videomega.tv/view.php?ref=090051111052065112106089103052052103089106112065052111051090', 
  27         'only_matching': True, 
  30     def _real_extract(self
, url
): 
  31         video_id 
= self
._match
_id
(url
) 
  33         iframe_url 
= 'http://videomega.tv/cdn.php?ref=%s' % video_id
 
  34         req 
= sanitized_Request(iframe_url
) 
  35         req
.add_header('Referer', url
) 
  36         req
.add_header('Cookie', 'noadvtday=0') 
  37         webpage 
= self
._download
_webpage
(req
, video_id
) 
  39         title 
= self
._html
_search
_regex
( 
  40             r
'<title>(.+?)</title>', webpage
, 'title') 
  42             r
'(?:^[Vv]ideo[Mm]ega\.tv\s-\s*|\s*-\svideomega\.tv$)', '', title
) 
  43         thumbnail 
= self
._search
_regex
( 
  44             r
'<video[^>]+?poster="([^"]+)"', webpage
, 'thumbnail', fatal
=False) 
  45         video_url 
= self
._search
_regex
( 
  46             r
'<source[^>]+?src="([^"]+)"', webpage
, 'video URL') 
  52             'thumbnail': thumbnail
, 
  54                 'Referer': iframe_url
,