]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/extremetube.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class ExtremeTubeIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?extremetube\.com/(?:[^/]+/)?video/(?P<id>[^/#?&]+)'
16 'url': 'http://www.extremetube.com/video/music-video-14-british-euro-brit-european-cumshots-swallow-652431',
17 'md5': '344d0c6d50e2f16b06e49ca011d8ac69',
19 'id': 'music-video-14-british-euro-brit-european-cumshots-swallow-652431',
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,
30 'url': 'http://www.extremetube.com/video/latina-slut-fucked-by-fat-black-dick',
31 'only_matching': True,
33 'url': 'http://www.extremetube.com/video/652431',
34 'only_matching': True,
37 def _real_extract(self
, url
):
38 video_id
= self
._match
_id
(url
)
40 req
= sanitized_Request(url
)
41 req
.add_header('Cookie', 'age_verified=1')
42 webpage
= self
._download
_webpage
(req
, video_id
)
44 video_title
= self
._html
_search
_regex
(
45 r
'<h1 [^>]*?title="([^"]+)"[^>]*>', webpage
, 'title')
46 uploader
= self
._html
_search
_regex
(
47 r
'Uploaded by:\s*</strong>\s*(.+?)\s*</div>',
48 webpage
, 'uploader', fatal
=False)
49 view_count
= str_to_int(self
._html
_search
_regex
(
50 r
'Views:\s*</strong>\s*<span>([\d,\.]+)</span>',
51 webpage
, 'view count', fatal
=False))
53 flash_vars
= self
._parse
_json
(
55 r
'var\s+flashvars\s*=\s*({.+?});', webpage
, 'flash vars'),
59 for quality_key
, video_url
in flash_vars
.items():
60 height
= int_or_none(self
._search
_regex
(
61 r
'quality_(\d+)[pP]$', quality_key
, 'height', default
=None))
68 r
'/(?P<height>\d{3,4})[pP]_(?P<bitrate>\d+)[kK]_\d+', video_url
)
70 height
= int(mobj
.group('height'))
71 bitrate
= int(mobj
.group('bitrate'))
73 'format_id': '%dp-%dk' % (height
, bitrate
),
79 'format_id': '%dp' % height
,
83 self
._sort
_formats
(formats
)
90 'view_count': view_count
,