]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/breakcom.py
809287d144ca7d629bf42bad7ac4e213a323e6dd
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class BreakIE(InfoExtractor
):
14 _VALID_URL
= r
'http://(?:www\.)?break\.com/video/(?:[^/]+/)*.+-(?P<id>\d+)'
16 'url': 'http://www.break.com/video/when-girls-act-like-guys-2468056',
20 'title': 'When Girls Act Like D-Bags',
23 'url': 'http://www.break.com/video/ugc/baby-flex-2773063',
24 'only_matching': True,
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(
30 'http://www.break.com/embed/%s' % video_id
, video_id
)
31 info
= json
.loads(self
._search
_regex
(
32 r
'var embedVars = ({.*})\s*?</script>',
33 webpage
, 'info json', flags
=re
.DOTALL
))
35 youtube_id
= info
.get('youtubeId')
37 return self
.url_result(youtube_id
, 'Youtube')
40 'url': media
['uri'] + '?' + info
['AuthToken'],
41 'tbr': media
['bitRate'],
42 'width': media
['width'],
43 'height': media
['height'],
44 } for media
in info
['media'] if media
.get('mediaPurpose') == 'play']
48 'url': info
['videoUri']
51 self
._sort
_formats
(formats
)
53 duration
= int_or_none(info
.get('videoLengthInSeconds'))
54 age_limit
= parse_age_limit(info
.get('audienceRating'))
58 'title': info
['contentName'],
59 'thumbnail': info
['thumbUri'],
61 'age_limit': age_limit
,