]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/videomega.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
17 class VideoMegaIE(InfoExtractor
):
18 _VALID_URL
= r
'''(?x)https?://
19 (?:www\.)?videomega\.tv/
20 (?:iframe\.php)?\?ref=(?P<id>[A-Za-z0-9]+)
23 'url': 'http://videomega.tv/?ref=QR0HCUHI1661IHUCH0RQ',
24 'md5': 'bf5c2f95c4c917536e80936af7bc51e1',
26 'id': 'QR0HCUHI1661IHUCH0RQ',
28 'title': 'Big Buck Bunny',
29 'thumbnail': 're:^https?://.*\.jpg$',
33 def _real_extract(self
, url
):
34 video_id
= self
._match
_id
(url
)
36 iframe_url
= 'http://videomega.tv/iframe.php?ref={0:}'.format(video_id
)
37 req
= compat_urllib_request
.Request(iframe_url
)
38 req
.add_header('Referer', url
)
39 webpage
= self
._download
_webpage
(req
, video_id
)
42 escaped_data
= re
.findall(r
'unescape\("([^"]+)"\)', webpage
)[-1]
44 raise ExtractorError('Unable to extract escaped data')
46 playlist
= compat_urllib_parse
.unquote(escaped_data
)
48 thumbnail
= self
._search
_regex
(
49 r
'image:\s*"([^"]+)"', playlist
, 'thumbnail', fatal
=False)
50 video_url
= self
._search
_regex
(r
'file:\s*"([^"]+)"', playlist
, 'URL')
51 title
= remove_start(self
._html
_search
_regex
(
52 r
'<title>(.*?)</title>', webpage
, 'title'), 'VideoMega.tv - ')
58 self
._sort
_formats
(formats
)
64 'thumbnail': thumbnail
,
65 'http_referer': iframe_url
,