X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/youtubedl/blobdiff_plain/a4f82408d9a3d921d9c2af7e4d757f44737dc7ea..46113edab215c2211a604c06245c16d5d4e57dcf:/youtube_dl/extractor/drtuber.py diff --git a/youtube_dl/extractor/drtuber.py b/youtube_dl/extractor/drtuber.py new file mode 100644 index 0000000..ca274df --- /dev/null +++ b/youtube_dl/extractor/drtuber.py @@ -0,0 +1,70 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import str_to_int + + +class DrTuberIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?drtuber\.com/video/(?P\d+)/(?P[\w-]+)' + _TEST = { + 'url': 'http://www.drtuber.com/video/1740434/hot-perky-blonde-naked-golf', + 'md5': '93e680cf2536ad0dfb7e74d94a89facd', + 'info_dict': { + 'id': '1740434', + 'display_id': 'hot-perky-blonde-naked-golf', + 'ext': 'mp4', + 'title': 'Hot Perky Blonde Naked Golf', + 'like_count': int, + 'dislike_count': int, + 'comment_count': int, + 'categories': ['Babe', 'Blonde', 'Erotic', 'Outdoor', 'Softcore', 'Solo'], + 'thumbnail': 're:https?://.*\.jpg$', + 'age_limit': 18, + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + display_id = mobj.group('display_id') + + webpage = self._download_webpage(url, display_id) + + video_url = self._html_search_regex( + r'([^<]+)\s*-\s*Free', webpage, 'title') + + thumbnail = self._html_search_regex( + r'poster="([^"]+)"', + webpage, 'thumbnail', fatal=False) + + like_count = str_to_int(self._html_search_regex( + r'\s*]+>\s*([\d,\.]+)', + webpage, 'like count', fatal=False)) + dislike_count = str_to_int(self._html_search_regex( + r'\s*]+>\s*([\d,\.]+)', + webpage, 'like count', fatal=False)) + comment_count = str_to_int(self._html_search_regex( + r'([\d,\.]+)', + webpage, 'comment count', fatal=False)) + + cats_str = self._search_regex( + r'Categories:
(.+?)
', webpage, 'categories', fatal=False) + categories = [] if not cats_str else re.findall(r'