4 from .common import InfoExtractor
6 compat_urllib_parse_urlparse,
15 class Tube8IE(InfoExtractor):
16 _VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>tube8\.com/[^/]+/[^/]+/(?P<videoid>[0-9]+)/?)'
18 u'url': u'http://www.tube8.com/teen/kasia-music-video/229795/',
19 u'file': u'229795.mp4',
20 u'md5': u'e9e0b0c86734e5e3766e653509475db0',
22 u"description": u"hot teen Kasia grinding",
23 u"uploader": u"unknown",
24 u"title": u"Kasia music video",
28 def _real_extract(self, url):
29 mobj = re.match(self._VALID_URL, url)
30 video_id = mobj.group('videoid')
31 url = 'http://www.' + mobj.group('url')
33 req = compat_urllib_request.Request(url)
34 req.add_header('Cookie', 'age_verified=1')
35 webpage = self._download_webpage(req, video_id)
37 video_title = self._html_search_regex(r'videotitle ="([^"]+)', webpage, u'title')
38 video_description = self._html_search_regex(r'>Description:</strong>(.+?)<', webpage, u'description', fatal=False)
39 video_uploader = self._html_search_regex(r'>Submitted by:</strong>(?:\s|<[^>]*>)*(.+?)<', webpage, u'uploader', fatal=False)
40 thumbnail = self._html_search_regex(r'"image_url":"([^"]+)', webpage, u'thumbnail', fatal=False)
42 thumbnail = thumbnail.replace('\\/', '/')
44 video_url = self._html_search_regex(r'"video_url":"([^"]+)', webpage, u'video_url')
45 if webpage.find('"encrypted":true')!=-1:
46 password = self._html_search_regex(r'"video_title":"([^"]+)', webpage, u'password')
47 video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8')
48 path = compat_urllib_parse_urlparse( video_url ).path
49 extension = os.path.splitext( path )[1][1:]
50 format = path.split('/')[4].split('_')[:2]
51 format = "-".join( format )
55 'uploader': video_uploader,
57 'thumbnail': thumbnail,
58 'description': video_description,