]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/megavideoz.py
af7ff07ea1e5818c3e0c94511328fd26c2458657
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class MegaVideozIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?megavideoz\.eu/video/(?P<id>[^/]+)(?:/(?P<display_id>[^/]+))?'
17 'url': 'http://megavideoz.eu/video/WM6UB919XMXH/SMPTE-Universal-Film-Leader',
20 'display_id': 'SMPTE-Universal-Film-Leader',
22 'title': 'SMPTE Universal Film Leader',
23 'thumbnail': 're:https?://.*?\.jpg',
28 def _real_extract(self
, url
):
29 mobj
= re
.match(self
._VALID
_URL
, url
)
30 video_id
= mobj
.group('id')
31 display_id
= mobj
.group('display_id') or video_id
33 webpage
= self
._download
_webpage
(url
, display_id
)
35 if any(p
in webpage
for p
in ('>Video Not Found<', '>404 Error<')):
36 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
38 config
= self
._download
_xml
(
40 r
"var\s+cnf\s*=\s*'([^']+)'", webpage
, 'cnf url'),
43 video_url
= xpath_text(config
, './file', 'video url', fatal
=True)
44 title
= xpath_text(config
, './title', 'title', fatal
=True)
45 thumbnail
= xpath_text(config
, './image', 'thumbnail')
46 duration
= float_or_none(xpath_text(config
, './duration', 'duration'))
47 video_id
= xpath_text(config
, './mediaid', 'video id') or video_id
51 'display_id': display_id
,
54 'thumbnail': thumbnail
,