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