]>
Commit | Line | Data |
---|---|---|
81650f95 S |
1 | # -*- coding: utf-8 -*- |
2 | from __future__ import unicode_literals | |
3 | ||
81650f95 S |
4 | from .common import InfoExtractor |
5 | ||
6 | ||
7 | class RUHDIE(InfoExtractor): | |
8 | _VALID_URL = r'http://(?:www\.)?ruhd\.ru/play\.php\?vid=(?P<id>\d+)' | |
9 | _TEST = { | |
10 | 'url': 'http://www.ruhd.ru/play.php?vid=207', | |
11 | 'md5': 'd1a9ec4edf8598e3fbd92bb16072ba83', | |
12 | 'info_dict': { | |
13 | 'id': '207', | |
14 | 'ext': 'divx', | |
15 | 'title': 'КОТ бааааам', | |
16 | 'description': 'классный кот)', | |
17 | 'thumbnail': 're:^http://.*\.jpg$', | |
18 | } | |
19 | } | |
20 | ||
21 | def _real_extract(self, url): | |
8d32abff | 22 | video_id = self._match_id(url) |
81650f95 S |
23 | webpage = self._download_webpage(url, video_id) |
24 | ||
25 | video_url = self._html_search_regex( | |
26 | r'<param name="src" value="([^"]+)"', webpage, 'video url') | |
27 | title = self._html_search_regex( | |
8d32abff PH |
28 | r'<title>([^<]+) RUHD.ru - Видео Высокого качества №1 в России!</title>', |
29 | webpage, 'title') | |
81650f95 | 30 | description = self._html_search_regex( |
8d32abff PH |
31 | r'(?s)<div id="longdesc">(.+?)<span id="showlink">', |
32 | webpage, 'description', fatal=False) | |
81650f95 | 33 | thumbnail = self._html_search_regex( |
8d32abff PH |
34 | r'<param name="previewImage" value="([^"]+)"', |
35 | webpage, 'thumbnail', fatal=False) | |
81650f95 S |
36 | if thumbnail: |
37 | thumbnail = 'http://www.ruhd.ru' + thumbnail | |
38 | ||
39 | return { | |
40 | 'id': video_id, | |
41 | 'url': video_url, | |
42 | 'title': title, | |
43 | 'description': description, | |
44 | 'thumbnail': thumbnail, | |
45 | } |