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