]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videomega.py
c02830dddcd838dbfc8070c17a009d5924a00f7e
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class VideoMegaIE(InfoExtractor
):
14 _VALID_URL
= r
'(?:videomega:|https?://(?:www\.)?videomega\.tv/(?:(?:view|iframe|cdn)\.php)?\?ref=)(?P<id>[A-Za-z0-9]+)'
16 'url': 'http://videomega.tv/cdn.php?ref=AOSQBJYKIDDIKYJBQSOA',
17 'md5': 'cc1920a58add3f05c6a93285b84fb3aa',
19 'id': 'AOSQBJYKIDDIKYJBQSOA',
22 'thumbnail': r
're:^https?://.*\.jpg$',
25 'url': 'http://videomega.tv/cdn.php?ref=AOSQBJYKIDDIKYJBQSOA&width=1070&height=600',
26 'only_matching': True,
28 'url': 'http://videomega.tv/view.php?ref=090051111052065112106089103052052103089106112065052111051090',
29 'only_matching': True,
32 def _real_extract(self
, url
):
33 video_id
= self
._match
_id
(url
)
35 iframe_url
= 'http://videomega.tv/cdn.php?ref=%s' % video_id
36 req
= sanitized_Request(iframe_url
)
37 req
.add_header('Referer', url
)
38 req
.add_header('Cookie', 'noadvtday=0')
39 webpage
= self
._download
_webpage
(req
, video_id
)
41 title
= self
._html
_search
_regex
(
42 r
'<title>(.+?)</title>', webpage
, 'title')
44 r
'(?:^[Vv]ideo[Mm]ega\.tv\s-\s*|\s*-\svideomega\.tv$)', '', title
)
45 thumbnail
= self
._search
_regex
(
46 r
'<video[^>]+?poster="([^"]+)"', webpage
, 'thumbnail', fatal
=False)
48 real_codes
= decode_packed_codes(webpage
)
49 video_url
= self
._search
_regex
(
50 r
'"src"\s*,\s*"([^"]+)"', real_codes
, 'video URL')
56 'thumbnail': thumbnail
,
58 'Referer': iframe_url
,