1 from __future__ import unicode_literals
6 from .common import InfoExtractor
8 compat_urllib_parse_urlparse,
14 class ExtremeTubeIE(InfoExtractor):
15 _VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>extremetube\.com/.*?video/.+?(?P<videoid>[0-9]+))(?:[/?&]|$)'
17 'url': 'http://www.extremetube.com/video/music-video-14-british-euro-brit-european-cumshots-swallow-652431',
18 'md5': '1fb9228f5e3332ec8c057d6ac36f33e0',
22 'title': 'Music Video 14 british euro brit european cumshots swallow',
23 'uploader': 'unknown',
27 'url': 'http://www.extremetube.com/gay/video/abcde-1234',
28 'only_matching': True,
31 def _real_extract(self, url):
32 mobj = re.match(self._VALID_URL, url)
33 video_id = mobj.group('videoid')
34 url = 'http://www.' + mobj.group('url')
36 req = compat_urllib_request.Request(url)
37 req.add_header('Cookie', 'age_verified=1')
38 webpage = self._download_webpage(req, video_id)
40 video_title = self._html_search_regex(
41 r'<h1 [^>]*?title="([^"]+)"[^>]*>\1<', webpage, 'title')
42 uploader = self._html_search_regex(
43 r'>Posted by:(?=<)(?:\s|<[^>]*>)*(.+?)\|', webpage, 'uploader',
45 video_url = compat_urllib_parse.unquote(self._html_search_regex(
46 r'video_url=(.+?)&', webpage, 'video_url'))
47 path = compat_urllib_parse_urlparse(video_url).path
48 format = path.split('/')[5].split('_')[:2]
49 format = "-".join(format)