]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videomega.py
9fc64d172e63ecb15469efc2a2085d8bccc06e53
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
14 class VideoMegaIE(InfoExtractor
):
15 _VALID_URL
= r
'''(?x)https?://
16 (?:www\.)?videomega\.tv/
17 (?:iframe\.php)?\?ref=(?P<id>[A-Za-z0-9]+)
20 'url': 'http://videomega.tv/?ref=QR0HCUHI1661IHUCH0RQ',
21 'md5': 'bf5c2f95c4c917536e80936af7bc51e1',
23 'id': 'QR0HCUHI1661IHUCH0RQ',
25 'title': 'Big Buck Bunny',
26 'thumbnail': 're:^https?://.*\.jpg$',
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
33 iframe_url
= 'http://videomega.tv/iframe.php?ref={0:}'.format(video_id
)
34 req
= compat_urllib_request
.Request(iframe_url
)
35 req
.add_header('Referer', url
)
36 webpage
= self
._download
_webpage
(req
, video_id
)
38 escaped_data
= self
._search
_regex
(
39 r
'unescape\("([^"]+)"\)', webpage
, 'escaped data')
40 playlist
= compat_urllib_parse
.unquote(escaped_data
)
42 thumbnail
= self
._search
_regex
(
43 r
'image:\s*"([^"]+)"', playlist
, 'thumbnail', fatal
=False)
44 video_url
= self
._search
_regex
(r
'file:\s*"([^"]+)"', playlist
, 'URL')
45 title
= remove_start(self
._html
_search
_regex
(
46 r
'<title>(.*?)</title>', webpage
, 'title'), 'VideoMega.tv - ')
52 self
._sort
_formats
(formats
)
58 'thumbnail': thumbnail
,
59 'http_referer': iframe_url
,