]>
Commit | Line | Data |
---|---|---|
d740f7e1 | 1 | from __future__ import unicode_literals |
2 | ||
3 | import re | |
4 | ||
5 | from .common import InfoExtractor | |
eade1d7e | 6 | from ..utils import str_to_int |
d740f7e1 | 7 | |
8 | ||
9 | class DrTuberIE(InfoExtractor): | |
1bf8cf5c | 10 | _VALID_URL = r'https?://(?:www\.)?drtuber\.com/video/(?P<id>\d+)/(?P<display_id>[\w-]+)' |
d740f7e1 | 11 | _TEST = { |
12 | 'url': 'http://www.drtuber.com/video/1740434/hot-perky-blonde-naked-golf', | |
13 | 'md5': '93e680cf2536ad0dfb7e74d94a89facd', | |
14 | 'info_dict': { | |
15 | 'id': '1740434', | |
33422c05 | 16 | 'display_id': 'hot-perky-blonde-naked-golf', |
d740f7e1 | 17 | 'ext': 'mp4', |
76d1466b | 18 | 'title': 'hot perky blonde naked golf', |
eade1d7e S |
19 | 'like_count': int, |
20 | 'dislike_count': int, | |
21 | 'comment_count': int, | |
2914e5f0 | 22 | 'categories': ['Babe', 'Blonde', 'Erotic', 'Outdoor', 'Softcore', 'Solo'], |
d740f7e1 | 23 | 'thumbnail': 're:https?://.*\.jpg$', |
11fc065c | 24 | 'age_limit': 18, |
d740f7e1 | 25 | } |
26 | } | |
27 | ||
28 | def _real_extract(self, url): | |
29 | mobj = re.match(self._VALID_URL, url) | |
30 | video_id = mobj.group('id') | |
1bf8cf5c | 31 | display_id = mobj.group('display_id') |
d740f7e1 | 32 | |
1bf8cf5c | 33 | webpage = self._download_webpage(url, display_id) |
d740f7e1 | 34 | |
35 | video_url = self._html_search_regex( | |
36 | r'<source src="([^"]+)"', webpage, 'video URL') | |
37 | ||
38 | title = self._html_search_regex( | |
86511ea4 | 39 | [r'<p[^>]+class="title_substrate">([^<]+)</p>', r'<title>([^<]+) - \d+'], |
76d1466b | 40 | webpage, 'title') |
d740f7e1 | 41 | |
42 | thumbnail = self._html_search_regex( | |
43 | r'poster="([^"]+)"', | |
44 | webpage, 'thumbnail', fatal=False) | |
45 | ||
86511ea4 S |
46 | def extract_count(id_, name): |
47 | return str_to_int(self._html_search_regex( | |
48 | r'<span[^>]+(?:class|id)="%s"[^>]*>([\d,\.]+)</span>' % id_, | |
49 | webpage, '%s count' % name, fatal=False)) | |
50 | ||
51 | like_count = extract_count('rate_likes', 'like') | |
52 | dislike_count = extract_count('rate_dislikes', 'dislike') | |
53 | comment_count = extract_count('comments_count', 'comment') | |
eade1d7e | 54 | |
2914e5f0 | 55 | cats_str = self._search_regex( |
86511ea4 | 56 | r'<div[^>]+class="categories_list">(.+?)</div>', webpage, 'categories', fatal=False) |
2914e5f0 | 57 | categories = [] if not cats_str else re.findall(r'<a title="([^"]+)"', cats_str) |
d740f7e1 | 58 | |
59 | return { | |
60 | 'id': video_id, | |
1bf8cf5c | 61 | 'display_id': display_id, |
d740f7e1 | 62 | 'url': video_url, |
63 | 'title': title, | |
64 | 'thumbnail': thumbnail, | |
eade1d7e S |
65 | 'like_count': like_count, |
66 | 'dislike_count': dislike_count, | |
67 | 'comment_count': comment_count, | |
d740f7e1 | 68 | 'categories': categories, |
11fc065c | 69 | 'age_limit': self._rta_search(webpage), |
d740f7e1 | 70 | } |