]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/videomega.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_request
10 class VideoMegaIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?videomega\.tv/(?:(?:view|iframe|cdn)\.php)?\?ref=(?P<id>[A-Za-z0-9]+)'
13 'url': 'http://videomega.tv/cdn.php?ref=AOSQBJYKIDDIKYJBQSOA',
14 'md5': 'cc1920a58add3f05c6a93285b84fb3aa',
16 'id': 'AOSQBJYKIDDIKYJBQSOA',
19 'thumbnail': 're:^https?://.*\.jpg$',
23 def _real_extract(self
, url
):
24 video_id
= self
._match
_id
(url
)
26 iframe_url
= 'http://videomega.tv/cdn.php?ref=%s' % video_id
27 req
= compat_urllib_request
.Request(iframe_url
)
28 req
.add_header('Referer', url
)
29 req
.add_header('Cookie', 'noadvtday=0')
30 webpage
= self
._download
_webpage
(req
, video_id
)
32 title
= self
._html
_search
_regex
(
33 r
'<title>(.+?)</title>', webpage
, 'title')
35 r
'(?:^[Vv]ideo[Mm]ega\.tv\s-\s*|\s*-\svideomega\.tv$)', '', title
)
36 thumbnail
= self
._search
_regex
(
37 r
'<video[^>]+?poster="([^"]+)"', webpage
, 'thumbnail', fatal
=False)
38 video_url
= self
._search
_regex
(
39 r
'<source[^>]+?src="([^"]+)"', webpage
, 'video URL')
45 'thumbnail': thumbnail
,
47 'Referer': iframe_url
,