1 from __future__ import unicode_literals
5 from .common import InfoExtractor
12 class DrTuberIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?drtuber\.com/video/(?P<id>\d+)/(?P<display_id>[\w-]+)'
15 'url': 'http://www.drtuber.com/video/1740434/hot-perky-blonde-naked-golf',
16 'md5': '93e680cf2536ad0dfb7e74d94a89facd',
19 'display_id': 'hot-perky-blonde-naked-golf',
21 'title': 'hot perky blonde naked golf',
24 'categories': ['Babe', 'Blonde', 'Erotic', 'Outdoor', 'Softcore', 'Solo'],
25 'thumbnail': 're:https?://.*\.jpg$',
30 def _real_extract(self, url):
31 mobj = re.match(self._VALID_URL, url)
32 video_id = mobj.group('id')
33 display_id = mobj.group('display_id')
35 webpage = self._download_webpage(url, display_id)
37 video_url = self._html_search_regex(
38 r'<source src="([^"]+)"', webpage, 'video URL')
40 title = self._html_search_regex(
41 [r'<p[^>]+class="title_substrate">([^<]+)</p>', r'<title>([^<]+) - \d+'],
44 thumbnail = self._html_search_regex(
46 webpage, 'thumbnail', fatal=False)
48 def extract_count(id_, name, default=NO_DEFAULT):
49 return str_to_int(self._html_search_regex(
50 r'<span[^>]+(?:class|id)="%s"[^>]*>([\d,\.]+)</span>' % id_,
51 webpage, '%s count' % name, default=default, fatal=False))
53 like_count = extract_count('rate_likes', 'like')
54 dislike_count = extract_count('rate_dislikes', 'dislike', default=None)
55 comment_count = extract_count('comments_count', 'comment')
57 cats_str = self._search_regex(
58 r'<div[^>]+class="categories_list">(.+?)</div>',
59 webpage, 'categories', fatal=False)
60 categories = [] if not cats_str else re.findall(
61 r'<a title="([^"]+)"', cats_str)
65 'display_id': display_id,
68 'thumbnail': thumbnail,
69 'like_count': like_count,
70 'dislike_count': dislike_count,
71 'comment_count': comment_count,
72 'categories': categories,
73 'age_limit': self._rta_search(webpage),