2 from __future__ import unicode_literals
4 from .common import InfoExtractor
13 class VideoMegaIE(InfoExtractor):
14 _VALID_URL = r'''(?x)https?://
15 (?:www\.)?videomega\.tv/
16 (?:iframe\.php)?\?ref=(?P<id>[A-Za-z0-9]+)
19 'url': 'http://videomega.tv/?ref=GKeGPVedBe',
20 'md5': '240fb5bcf9199961f48eb17839b084d6',
24 'title': 'XXL - All Sports United',
25 'thumbnail': 're:^https?://.*\.jpg$',
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
31 url = 'http://videomega.tv/iframe.php?ref={0:}'.format(video_id)
32 webpage = self._download_webpage(url, video_id)
34 escaped_data = self._search_regex(
35 r'unescape\("([^"]+)"\)', webpage, 'escaped data')
36 playlist = compat_urllib_parse.unquote(escaped_data)
38 thumbnail = self._search_regex(
39 r'image:\s*"([^"]+)"', playlist, 'thumbnail', fatal=False)
40 url = self._search_regex(r'file:\s*"([^"]+)"', playlist, 'URL')
41 title = remove_start(self._html_search_regex(
42 r'<title>(.*?)</title>', webpage, 'title'), 'VideoMega.tv - ')
48 self._sort_formats(formats)
54 'thumbnail': thumbnail,