1 from __future__ import unicode_literals
5 from .common import InfoExtractor
16 class ExtremeTubeIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?(?P<url>extremetube\.com/.*?video/.+?(?P<id>[0-9]+))(?:[/?&]|$)'
19 'url': 'http://www.extremetube.com/video/music-video-14-british-euro-brit-european-cumshots-swallow-652431',
20 'md5': '344d0c6d50e2f16b06e49ca011d8ac69',
24 'title': 'Music Video 14 british euro brit european cumshots swallow',
25 'uploader': 'unknown',
30 'url': 'http://www.extremetube.com/gay/video/abcde-1234',
31 'only_matching': True,
34 def _real_extract(self, url):
35 mobj = re.match(self._VALID_URL, url)
36 video_id = mobj.group('id')
37 url = 'http://www.' + mobj.group('url')
39 req = compat_urllib_request.Request(url)
40 req.add_header('Cookie', 'age_verified=1')
41 webpage = self._download_webpage(req, video_id)
43 video_title = self._html_search_regex(
44 r'<h1 [^>]*?title="([^"]+)"[^>]*>', webpage, 'title')
45 uploader = self._html_search_regex(
46 r'Uploaded by:\s*</strong>\s*(.+?)\s*</div>',
47 webpage, 'uploader', fatal=False)
48 view_count = str_to_int(self._html_search_regex(
49 r'Views:\s*</strong>\s*<span>([\d,\.]+)</span>',
50 webpage, 'view count', fatal=False))
52 flash_vars = compat_parse_qs(self._search_regex(
53 r'<param[^>]+?name="flashvars"[^>]+?value="([^"]+)"', webpage, 'flash vars'))
56 quality = qualities(['180p', '240p', '360p', '480p', '720p', '1080p'])
57 for k, vals in flash_vars.items():
58 m = re.match(r'quality_(?P<quality>[0-9]+p)$', k)
61 'format_id': m.group('quality'),
62 'quality': quality(m.group('quality')),
66 self._sort_formats(formats)
73 'view_count': view_count,