]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ruhd.py
Update changelog.
[youtubedl] / youtube_dl / extractor / ruhd.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class RUHDIE(InfoExtractor):
8 _VALID_URL = r'https?://(?: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': r're:^http://.*\.jpg$',
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
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(
28 r'<title>([^<]+)&nbsp;&nbsp; RUHD\.ru - Видео Высокого качества №1 в России!</title>',
29 webpage, 'title')
30 description = self._html_search_regex(
31 r'(?s)<div id="longdesc">(.+?)<span id="showlink">',
32 webpage, 'description', fatal=False)
33 thumbnail = self._html_search_regex(
34 r'<param name="previewImage" value="([^"]+)"',
35 webpage, 'thumbnail', fatal=False)
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 }