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.

46 lines
1.6 KiB

  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class RUHDIE(InfoExtractor):
  6. _VALID_URL = r'http://(?:www\.)?ruhd\.ru/play\.php\?vid=(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'http://www.ruhd.ru/play.php?vid=207',
  9. 'md5': 'd1a9ec4edf8598e3fbd92bb16072ba83',
  10. 'info_dict': {
  11. 'id': '207',
  12. 'ext': 'divx',
  13. 'title': 'КОТ бааааам',
  14. 'description': 'классный кот)',
  15. 'thumbnail': 're:^http://.*\.jpg$',
  16. }
  17. }
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group('id')
  21. webpage = self._download_webpage(url, video_id)
  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>', webpage, 'title')
  26. description = self._html_search_regex(
  27. r'(?s)<div id="longdesc">(.+?)<span id="showlink">', webpage, 'description', fatal=False)
  28. thumbnail = self._html_search_regex(
  29. r'<param name="previewImage" value="([^"]+)"', webpage, 'thumbnail', fatal=False)
  30. if thumbnail:
  31. thumbnail = 'http://www.ruhd.ru' + thumbnail
  32. return {
  33. 'id': video_id,
  34. 'url': video_url,
  35. 'title': title,
  36. 'description': description,
  37. 'thumbnail': thumbnail,
  38. }