1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..compat import compat_urllib_request
13 class ExtremeTubeIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?(?P<url>extremetube\.com/.*?video/.+?(?P<id>[0-9]+))(?:[/?&]|$)'
16 'url': 'http://www.extremetube.com/video/music-video-14-british-euro-brit-european-cumshots-swallow-652431',
17 'md5': '344d0c6d50e2f16b06e49ca011d8ac69',
21 'title': 'Music Video 14 british euro brit european cumshots swallow',
22 '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('id')
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="([^"]+)"[^>]*>', webpage, 'title')
42 uploader = self._html_search_regex(
43 r'Uploaded by:\s*</strong>\s*(.+?)\s*</div>',
44 webpage, 'uploader', fatal=False)
45 view_count = str_to_int(self._html_search_regex(
46 r'Views:\s*</strong>\s*<span>([\d,\.]+)</span>',
47 webpage, 'view count', fatal=False))
49 flash_vars = self._parse_json(
51 r'var\s+flashvars\s*=\s*({.+?});', webpage, 'flash vars'),
55 for quality_key, video_url in flash_vars.items():
56 height = int_or_none(self._search_regex(
57 r'quality_(\d+)[pP]$', quality_key, 'height', default=None))
64 r'/(?P<height>\d{3,4})[pP]_(?P<bitrate>\d+)[kK]_\d+', video_url)
66 height = int(mobj.group('height'))
67 bitrate = int(mobj.group('bitrate'))
69 'format_id': '%dp-%dk' % (height, bitrate),
75 'format_id': '%dp' % height,
79 self._sort_formats(formats)
86 'view_count': view_count,