1 from __future__ import unicode_literals
6 from .common import InfoExtractor
8 compat_urllib_parse_urlparse,
12 class XTubeIE(InfoExtractor):
13 _VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>xtube\.com/watch\.php\?v=(?P<videoid>[^/?&]+))'
15 'url': 'http://www.xtube.com/watch.php?v=kVTUy_G222_',
16 'file': 'kVTUy_G222_.mp4',
17 'md5': '092fbdd3cbe292c920ef6fc6a8a9cdab',
19 "title": "strange erotica",
20 "description": "surreal gay themed erotica...almost an ET kind of thing",
21 "uploader": "greenshowers",
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('videoid')
29 url = 'http://www.' + mobj.group('url')
31 req = compat_urllib_request.Request(url)
32 req.add_header('Cookie', 'age_verified=1')
33 webpage = self._download_webpage(req, video_id)
35 video_title = self._html_search_regex(r'<div class="p_5px[^>]*>([^<]+)', webpage, 'title')
36 video_uploader = self._html_search_regex(r'so_s\.addVariable\("owner_u", "([^"]+)', webpage, 'uploader', fatal=False)
37 video_description = self._html_search_regex(r'<p class="video_description">([^<]+)', webpage, 'description', fatal=False)
38 video_url= self._html_search_regex(r'var videoMp4 = "([^"]+)', webpage, 'video_url').replace('\\/', '/')
39 path = compat_urllib_parse_urlparse(video_url).path
40 extension = os.path.splitext(path)[1][1:]
41 format = path.split('/')[5].split('_')[:2]
44 format = "-".join(format)
49 'uploader': video_uploader,
50 'description': video_description,