You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class RUHDIE(InfoExtractor):
  5. _VALID_URL = r'http://(?: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': 're:^http://.*\.jpg$',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(url, video_id)
  20. video_url = self._html_search_regex(
  21. r'<param name="src" value="([^"]+)"', webpage, 'video url')
  22. title = self._html_search_regex(
  23. r'<title>([^<]+)&nbsp;&nbsp; RUHD.ru - Видео Высокого качества №1 в России!</title>',
  24. webpage, 'title')
  25. description = self._html_search_regex(
  26. r'(?s)<div id="longdesc">(.+?)<span id="showlink">',
  27. webpage, 'description', fatal=False)
  28. thumbnail = self._html_search_regex(
  29. r'<param name="previewImage" value="([^"]+)"',
  30. webpage, 'thumbnail', fatal=False)
  31. if thumbnail:
  32. thumbnail = 'http://www.ruhd.ru' + thumbnail
  33. return {
  34. 'id': video_id,
  35. 'url': video_url,
  36. 'title': title,
  37. 'description': description,
  38. 'thumbnail': thumbnail,
  39. }