]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/breakcom.py
725859b4d2d554df91ff4793a2b3d245f02c8996
   1 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class BreakIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?: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', 
  24         'url': 'http://www.break.com/video/ugc/baby-flex-2773063', 
  25         'only_matching': True, 
  28     def _real_extract(self
, url
): 
  29         video_id 
= self
._match
_id
(url
) 
  30         webpage 
= self
._download
_webpage
( 
  31             'http://www.break.com/embed/%s' % video_id
, video_id
) 
  32         info 
= json
.loads(self
._search
_regex
( 
  33             r
'var embedVars = ({.*})\s*?</script>', 
  34             webpage
, 'info json', flags
=re
.DOTALL
)) 
  36         youtube_id 
= info
.get('youtubeId') 
  38             return self
.url_result(youtube_id
, 'Youtube') 
  41             'url': media
['uri'] + '?' + info
['AuthToken'], 
  42             'tbr': media
['bitRate'], 
  43             'width': media
['width'], 
  44             'height': media
['height'], 
  45         } for media 
in info
['media'] if media
.get('mediaPurpose') == 'play'] 
  49                 'url': info
['videoUri'] 
  52         self
._sort
_formats
(formats
) 
  54         duration 
= int_or_none(info
.get('videoLengthInSeconds')) 
  55         age_limit 
= parse_age_limit(info
.get('audienceRating')) 
  59             'title': info
['contentName'], 
  60             'thumbnail': info
['thumbUri'], 
  62             'age_limit': age_limit
,