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