]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videomega.py
2 from __future__
import unicode_literals
6 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 mobj
= re
.match(self
._VALID
_URL
, url
)
31 video_id
= mobj
.group('id')
33 url
= 'http://videomega.tv/iframe.php?ref={0:}'.format(video_id
)
34 webpage
= self
._download
_webpage
(url
, video_id
)
36 escaped_data
= self
._search
_regex
(
37 r
'unescape\("([^"]+)"\)', webpage
, 'escaped data')
38 playlist
= compat_urllib_parse
.unquote(escaped_data
)
40 thumbnail
= self
._search
_regex
(
41 r
'image:\s*"([^"]+)"', playlist
, 'thumbnail', fatal
=False)
42 url
= self
._search
_regex
(r
'file:\s*"([^"]+)"', playlist
, 'URL')
43 title
= remove_start(self
._html
_search
_regex
(
44 r
'<title>(.*?)</title>', webpage
, 'title'), 'VideoMega.tv - ')
50 self
._sort
_formats
(formats
)
56 'thumbnail': thumbnail
,