4 from .common
import InfoExtractor
6 compat_urllib_parse_urlparse
,
11 class XTubeIE(InfoExtractor
):
12 _VALID_URL
= r
'^(?:https?://)?(?:www\.)?(?P<url>xtube\.com/watch\.php\?v=(?P<videoid>[^/?&]+))'
14 u
'url': u
'http://www.xtube.com/watch.php?v=kVTUy_G222_',
15 u
'file': u
'kVTUy_G222_.mp4',
16 u
'md5': u
'092fbdd3cbe292c920ef6fc6a8a9cdab',
18 u
"title": u
"strange erotica",
19 u
"description": u
"surreal gay themed erotica...almost an ET kind of thing",
20 u
"uploader": u
"greenshowers",
25 def _real_extract(self
, url
):
26 mobj
= re
.match(self
._VALID
_URL
, url
)
27 video_id
= mobj
.group('videoid')
28 url
= 'http://www.' + mobj
.group('url')
30 req
= compat_urllib_request
.Request(url
)
31 req
.add_header('Cookie', 'age_verified=1')
32 webpage
= self
._download
_webpage
(req
, video_id
)
34 video_title
= self
._html
_search
_regex
(r
'<div class="p_5px[^>]*>([^<]+)', webpage
, u
'title')
35 video_uploader
= self
._html
_search
_regex
(r
'so_s\.addVariable\("owner_u", "([^"]+)', webpage
, u
'uploader', fatal
=False)
36 video_description
= self
._html
_search
_regex
(r
'<p class="video_description">([^<]+)', webpage
, u
'description', default
=None)
37 video_url
= self
._html
_search
_regex
(r
'var videoMp4 = "([^"]+)', webpage
, u
'video_url').replace('\\/', '/')
38 path
= compat_urllib_parse_urlparse(video_url
).path
39 extension
= os
.path
.splitext(path
)[1][1:]
40 format
= path
.split('/')[5].split('_')[:2]
43 format
= "-".join(format
)
48 'uploader': video_uploader
,
49 'description': video_description
,