]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mojvideo.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class MojvideoIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?mojvideo\.com/video-(?P<display_id>[^/]+)/(?P<id>[a-f0-9]+)'
16 'url': 'http://www.mojvideo.com/video-v-avtu-pred-mano-rdecelaska-alfi-nipic/3d1ed4497707730b2906',
17 'md5': 'f7fd662cc8ce2be107b0d4f2c0483ae7',
19 'id': '3d1ed4497707730b2906',
20 'display_id': 'v-avtu-pred-mano-rdecelaska-alfi-nipic',
22 'title': 'V avtu pred mano rdečelaska - Alfi Nipič',
23 'thumbnail': 're:^http://.*\.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')
34 playerapi
= self
._download
_webpage
(
35 'http://www.mojvideo.com/playerapi.php?v=%s&t=1' % video_id
, display_id
)
37 if '<error>true</error>' in playerapi
:
38 error_desc
= self
._html
_search
_regex
(
39 r
'<errordesc>([^<]*)</errordesc>', playerapi
, 'error description', fatal
=False)
40 raise ExtractorError('%s said: %s' % (self
.IE_NAME
, error_desc
), expected
=True)
42 title
= self
._html
_search
_regex
(
43 r
'<title>([^<]+)</title>', playerapi
, 'title')
44 video_url
= self
._html
_search
_regex
(
45 r
'<file>([^<]+)</file>', playerapi
, 'video URL')
46 thumbnail
= self
._html
_search
_regex
(
47 r
'<preview>([^<]+)</preview>', playerapi
, 'thumbnail', fatal
=False)
48 duration
= parse_duration(self
._html
_search
_regex
(
49 r
'<duration>([^<]+)</duration>', playerapi
, 'duration', fatal
=False))
53 'display_id': display_id
,
56 'thumbnail': thumbnail
,