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.

70 lines
2.5 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import str_to_int
  5. class DrTuberIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?drtuber\.com/video/(?P<id>\d+)/(?P<display_id>[\w-]+)'
  7. _TEST = {
  8. 'url': 'http://www.drtuber.com/video/1740434/hot-perky-blonde-naked-golf',
  9. 'md5': '93e680cf2536ad0dfb7e74d94a89facd',
  10. 'info_dict': {
  11. 'id': '1740434',
  12. 'display_id': 'hot-perky-blonde-naked-golf',
  13. 'ext': 'mp4',
  14. 'title': 'Hot Perky Blonde Naked Golf',
  15. 'like_count': int,
  16. 'dislike_count': int,
  17. 'comment_count': int,
  18. 'categories': ['Babe', 'Blonde', 'Erotic', 'Outdoor', 'Softcore', 'Solo'],
  19. 'thumbnail': 're:https?://.*\.jpg$',
  20. 'age_limit': 18,
  21. }
  22. }
  23. def _real_extract(self, url):
  24. mobj = re.match(self._VALID_URL, url)
  25. video_id = mobj.group('id')
  26. display_id = mobj.group('display_id')
  27. webpage = self._download_webpage(url, display_id)
  28. video_url = self._html_search_regex(
  29. r'<source src="([^"]+)"', webpage, 'video URL')
  30. title = self._html_search_regex(
  31. r'<title>([^<]+)\s*-\s*Free', webpage, 'title')
  32. thumbnail = self._html_search_regex(
  33. r'poster="([^"]+)"',
  34. webpage, 'thumbnail', fatal=False)
  35. like_count = str_to_int(self._html_search_regex(
  36. r'<span id="rate_likes">\s*<img[^>]+>\s*<span>([\d,\.]+)</span>',
  37. webpage, 'like count', fatal=False))
  38. dislike_count = str_to_int(self._html_search_regex(
  39. r'<span id="rate_dislikes">\s*<img[^>]+>\s*<span>([\d,\.]+)</span>',
  40. webpage, 'like count', fatal=False))
  41. comment_count = str_to_int(self._html_search_regex(
  42. r'<span class="comments_count">([\d,\.]+)</span>',
  43. webpage, 'comment count', fatal=False))
  44. cats_str = self._search_regex(
  45. r'<span>Categories:</span><div>(.+?)</div>', webpage, 'categories', fatal=False)
  46. categories = [] if not cats_str else re.findall(r'<a title="([^"]+)"', cats_str)
  47. return {
  48. 'id': video_id,
  49. 'display_id': display_id,
  50. 'url': video_url,
  51. 'title': title,
  52. 'thumbnail': thumbnail,
  53. 'like_count': like_count,
  54. 'dislike_count': dislike_count,
  55. 'comment_count': comment_count,
  56. 'categories': categories,
  57. 'age_limit': self._rta_search(webpage),
  58. }