]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/ruhd.py
[ie/box] Fix formats extraction (#8649)
[yt-dlp.git] / yt_dlp / extractor / ruhd.py
CommitLineData
81650f95
S
1from .common import InfoExtractor
2
3
4class RUHDIE(InfoExtractor):
5886b38d 5 _VALID_URL = r'https?://(?:www\.)?ruhd\.ru/play\.php\?vid=(?P<id>\d+)'
81650f95
S
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': 'классный кот)',
ec85ded8 14 'thumbnail': r're:^http://.*\.jpg$',
81650f95
S
15 }
16 }
17
18 def _real_extract(self, url):
8d32abff 19 video_id = self._match_id(url)
81650f95
S
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(
197224b7 25 r'<title>([^<]+)&nbsp;&nbsp; RUHD\.ru - Видео Высокого качества №1 в России!</title>',
8d32abff 26 webpage, 'title')
81650f95 27 description = self._html_search_regex(
8d32abff
PH
28 r'(?s)<div id="longdesc">(.+?)<span id="showlink">',
29 webpage, 'description', fatal=False)
81650f95 30 thumbnail = self._html_search_regex(
8d32abff
PH
31 r'<param name="previewImage" value="([^"]+)"',
32 webpage, 'thumbnail', fatal=False)
81650f95
S
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 }