]>
Commit | Line | Data |
---|---|---|
5537dce8 DF |
1 | import re |
2 | ||
3 | from .common import InfoExtractor | |
4 | ||
5 | class MojvideoIE(InfoExtractor): | |
6 | _VALID_URL = r'https?://(?:www\.)?mojvideo\.com/video-.*/(?P<id>[a-f0-9]+)' | |
7 | _TEST = { | |
8 | 'url': 'http://www.mojvideo.com/video-v-avtu-pred-mano-rdecelaska-alfi-nipic/3d1ed4497707730b2906', | |
9 | 'md5': 'f7fd662cc8ce2be107b0d4f2c0483ae7', | |
10 | 'info_dict': { | |
11 | 'id': '3d1ed4497707730b2906', | |
12 | 'ext': 'mp4', | |
13 | 'title': 'V avtu pred mano rdečelaska - Alfi Nipič', | |
14 | 'description':'Video: V avtu pred mano rdečelaska - Alfi Nipič', | |
78b296b0 | 15 | 'height':378, |
5537dce8 | 16 | 'width':480 |
5537dce8 DF |
17 | } |
18 | } | |
19 | ||
20 | def _real_extract(self, url): | |
21 | mobj = re.match(self._VALID_URL, url) | |
22 | video_id = mobj.group('id') | |
23 | ||
5537dce8 DF |
24 | webpage = self._download_webpage(url, video_id) |
25 | title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title') | |
26 | description = self._search_regex(r'<meta name="description" content="(.*)" />', webpage, 'video description') | |
27 | final_url = self._html_search_regex(r'mp4: \'(.*)\'', webpage, 'video url') | |
28 | height=int(self._search_regex(r'<meta name="video_height" content="([0-9]*)" />',webpage,"video height")) | |
29 | width=int(self._search_regex(r'<meta name="video_width" content="([0-9]*)" />',webpage,"video width")) | |
30 | ||
31 | return { | |
32 | 'id': video_id, | |
33 | 'title': title, | |
34 | 'description': description, | |
35 | 'ext': 'mp4', | |
36 | 'url': final_url, | |
37 | 'height':height, | |
38 | 'width':width | |
5537dce8 | 39 | } |