1 from __future__ import unicode_literals
5 from .common import InfoExtractor
7 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',
28 'url': 'http://www.extremetube.com/gay/video/abcde-1234',
29 'only_matching': True,
32 def _real_extract(self, url):
33 mobj = re.match(self._VALID_URL, url)
34 video_id = mobj.group('videoid')
35 url = 'http://www.' + mobj.group('url')
37 req = compat_urllib_request.Request(url)
38 req.add_header('Cookie', 'age_verified=1')
39 webpage = self._download_webpage(req, video_id)
41 video_title = self._html_search_regex(
42 r'<h1 [^>]*?title="([^"]+)"[^>]*>', webpage, 'title')
43 uploader = self._html_search_regex(
44 r'Uploaded by:\s*</strong>\s*(.+?)\s*</div>',
45 webpage, 'uploader', fatal=False)
46 view_count = str_to_int(self._html_search_regex(
47 r'Views:\s*</strong>\s*<span>([\d,\.]+)</span>',
48 webpage, 'view count', fatal=False))
50 video_url = compat_urllib_parse.unquote(self._html_search_regex(
51 r'video_url=(.+?)&', webpage, 'video_url'))
52 path = compat_urllib_parse_urlparse(video_url).path
53 format = path.split('/')[5].split('_')[:2]
54 format = "-".join(format)
60 'view_count': view_count,