1 from __future__ import unicode_literals
6 from .common import InfoExtractor
8 compat_urllib_parse_urlparse,
13 from ..aes import aes_decrypt_text
16 class Tube8IE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?tube8\.com/(?:[^/]+/)+(?P<display_id>[^/]+)/(?P<id>\d+)'
20 'url': 'http://www.tube8.com/teen/kasia-music-video/229795/',
21 'md5': '44bf12b98313827dd52d35b8706a4ea0',
24 'display_id': 'kasia-music-video',
26 'description': 'hot teen Kasia grinding',
27 'uploader': 'unknown',
28 'title': 'Kasia music video',
33 'url': 'http://www.tube8.com/shemale/teen/blonde-cd-gets-kidnapped-by-two-blacks-and-punished-for-being-a-slutty-girl/19569151/',
34 'only_matching': True,
38 def _real_extract(self, url):
39 mobj = re.match(self._VALID_URL, url)
40 video_id = mobj.group('id')
41 display_id = mobj.group('display_id')
43 req = compat_urllib_request.Request(url)
44 req.add_header('Cookie', 'age_verified=1')
45 webpage = self._download_webpage(req, display_id)
47 flashvars = json.loads(self._html_search_regex(
48 r'var flashvars\s*=\s*({.+?})', webpage, 'flashvars'))
50 video_url = flashvars['video_url']
51 if flashvars.get('encrypted') is True:
52 video_url = aes_decrypt_text(video_url, flashvars['video_title'], 32).decode('utf-8')
53 path = compat_urllib_parse_urlparse(video_url).path
54 format_id = '-'.join(path.split('/')[4].split('_')[:2])
56 thumbnail = flashvars.get('image_url')
58 title = self._html_search_regex(
59 r'videotitle\s*=\s*"([^"]+)', webpage, 'title')
60 description = self._html_search_regex(
61 r'>Description:</strong>(.+?)<', webpage, 'description', fatal=False)
62 uploader = self._html_search_regex(
63 r'<strong class="video-username">(?:<a href="[^"]+">)?([^<]+)(?:</a>)?</strong>',
64 webpage, 'uploader', fatal=False)
66 like_count = int_or_none(self._html_search_regex(
67 r"rupVar\s*=\s*'(\d+)'", webpage, 'like count', fatal=False))
68 dislike_count = int_or_none(self._html_search_regex(
69 r"rdownVar\s*=\s*'(\d+)'", webpage, 'dislike count', fatal=False))
70 view_count = self._html_search_regex(
71 r'<strong>Views: </strong>([\d,\.]+)</li>', webpage, 'view count', fatal=False)
73 view_count = str_to_int(view_count)
74 comment_count = self._html_search_regex(
75 r'<span id="allCommentsCount">(\d+)</span>', webpage, 'comment count', fatal=False)
77 comment_count = str_to_int(comment_count)
81 'display_id': display_id,
84 'description': description,
85 'thumbnail': thumbnail,
87 'format_id': format_id,
88 'view_count': view_count,
89 'like_count': like_count,
90 'dislike_count': dislike_count,
91 'comment_count': comment_count,