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",
29 def _real_extract(self, url):
30 mobj = re.match(self._VALID_URL, url)
31 video_id = mobj.group('videoid')
32 url = 'http://www.' + mobj.group('url')
34 req = compat_urllib_request.Request(url)
35 req.add_header('Cookie', 'age_verified=1')
36 webpage = self._download_webpage(req, video_id)
38 video_title = self._html_search_regex(r'videotitle ="([^"]+)', webpage, u'title')
39 video_description = self._html_search_regex(r'>Description:</strong>(.+?)<', webpage, u'description', fatal=False)
40 video_uploader = self._html_search_regex(r'>Submitted by:</strong>(?:\s|<[^>]*>)*(.+?)<', webpage, u'uploader', fatal=False)
41 thumbnail = self._html_search_regex(r'"image_url":"([^"]+)', webpage, u'thumbnail', fatal=False)
43 thumbnail = thumbnail.replace('\\/', '/')
45 video_url = self._html_search_regex(r'"video_url":"([^"]+)', webpage, u'video_url')
46 if webpage.find('"encrypted":true')!=-1:
47 password = self._html_search_regex(r'"video_title":"([^"]+)', webpage, u'password')
48 video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8')
49 path = compat_urllib_parse_urlparse( video_url ).path
50 extension = os.path.splitext( path )[1][1:]
51 format = path.split('/')[4].split('_')[:2]
52 format = "-".join( format )
56 'uploader': video_uploader,
58 'thumbnail': thumbnail,
59 'description': video_description,