]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/drtuber.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class DrTuberIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?drtuber\.com/(?:video|embed)/(?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$',
29 'url': 'http://www.drtuber.com/embed/489939',
30 'only_matching': True,
34 def _extract_urls(webpage
):
36 r
'<iframe[^>]+?src=["\'](?P
<url
>(?
:https?
:)?
//(?
:www\
.)?drtuber\
.com
/embed
/\d
+)',
39 def _real_extract(self, url):
40 mobj = re.match(self._VALID_URL, url)
41 video_id = mobj.group('id')
42 display_id = mobj.group('display_id
') or video_id
44 webpage = self._download_webpage(
45 'http
://www
.drtuber
.com
/video
/%s' % video_id, display_id)
47 video_url = self._html_search_regex(
48 r'<source src
="([^"]+)"', webpage, 'video URL')
50 title = self._html_search_regex(
51 (r'class="title_watch
"[^>]*><(?:p|h\d+)[^>]*>([^<]+)<',
52 r'<p[^>]+class="title_substrate
">([^<]+)</p>',
53 r'<title>([^<]+) - \d+'),
56 thumbnail = self._html_search_regex(
58 webpage, 'thumbnail
', fatal=False)
60 def extract_count(id_, name, default=NO_DEFAULT):
61 return str_to_int(self._html_search_regex(
62 r'<span
[^
>]+(?
:class|
id)="%s"[^
>]*>([\d
,\
.]+)</span
>' % id_,
63 webpage, '%s count
' % name, default=default, fatal=False))
65 like_count = extract_count('rate_likes
', 'like
')
66 dislike_count = extract_count('rate_dislikes
', 'dislike
', default=None)
67 comment_count = extract_count('comments_count
', 'comment
')
69 cats_str = self._search_regex(
70 r'<div
[^
>]+class="categories_list">(.+?
)</div
>',
71 webpage, 'categories
', fatal=False)
72 categories = [] if not cats_str else re.findall(
73 r'<a title
="([^"]+)"', cats_str)
77 'display_id': display_id,
80 'thumbnail': thumbnail,
81 'like_count': like_count,
82 'dislike_count': dislike_count,
83 'comment_count': comment_count,
84 'categories': categories,
85 'age_limit': self._rta_search(webpage),