1 from __future__ import unicode_literals
5 from .common import InfoExtractor
14 class DrTuberIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:(?:www|m)\.)?drtuber\.com/(?:video|embed)/(?P<id>\d+)(?:/(?P<display_id>[\w-]+))?'
17 'url': 'http://www.drtuber.com/video/1740434/hot-perky-blonde-naked-golf',
18 'md5': '93e680cf2536ad0dfb7e74d94a89facd',
21 'display_id': 'hot-perky-blonde-naked-golf',
23 'title': 'hot perky blonde naked golf',
26 'categories': ['Babe', 'Blonde', 'Erotic', 'Outdoor', 'Softcore', 'Solo'],
27 'thumbnail': r're:https?://.*\.jpg$',
31 'url': 'http://www.drtuber.com/embed/489939',
32 'only_matching': True,
34 'url': 'http://m.drtuber.com/video/3893529/lingerie-blowjob-from-beautiful-teen',
35 'only_matching': True,
39 def _extract_urls(webpage):
41 r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//(?:www\.)?drtuber\.com/embed/\d+)',
44 def _real_extract(self, url):
45 mobj = re.match(self._VALID_URL, url)
46 video_id = mobj.group('id')
47 display_id = mobj.group('display_id') or video_id
49 webpage = self._download_webpage(
50 'http://www.drtuber.com/video/%s' % video_id, display_id)
52 video_data = self._download_json(
53 'http://www.drtuber.com/player_config_json/', video_id, query={
61 for format_id, video_url in video_data['files'].items():
64 'format_id': format_id,
65 'quality': 2 if format_id == 'hq' else 1,
68 self._sort_formats(formats)
70 duration = int_or_none(video_data.get('duration')) or parse_duration(
71 video_data.get('duration_format'))
73 title = self._html_search_regex(
74 (r'<h1[^>]+class=["\']title[^>]+>([^<]+)',
75 r'<title>([^<]+)\s*@\s+DrTuber',
76 r'class="title_watch"[^>]*><(?:p|h\d+)[^>]*>([^<]+)<',
77 r'<p[^>]+class="title_substrate">([^<]+)</p>',
78 r'<title>([^<]+) - \d+'),
81 thumbnail = self._html_search_regex(
83 webpage, 'thumbnail', fatal=False)
85 def extract_count(id_, name, default=NO_DEFAULT):
86 return str_to_int(self._html_search_regex(
87 r'<span[^>]+(?:class|id)="%s"[^>]*>([\d,\.]+)</span>' % id_,
88 webpage, '%s count' % name, default=default, fatal=False))
90 like_count = extract_count('rate_likes', 'like')
91 dislike_count = extract_count('rate_dislikes', 'dislike', default=None)
92 comment_count = extract_count('comments_count', 'comment')
94 cats_str = self._search_regex(
95 r'<div[^>]+class="categories_list">(.+?)</div>',
96 webpage, 'categories', fatal=False)
97 categories = [] if not cats_str else re.findall(
98 r'<a title="([^"]+)"', cats_str)
102 'display_id': display_id,
105 'thumbnail': thumbnail,
106 'like_count': like_count,
107 'dislike_count': dislike_count,
108 'comment_count': comment_count,
109 'categories': categories,
110 'age_limit': self._rta_search(webpage),
111 'duration': duration,