- video_id = self._match_id(url)
- webpage = self._download_webpage(
- 'http://www.break.com/embed/%s' % video_id, video_id)
- info = json.loads(self._search_regex(
- r'var embedVars = ({.*})\s*?</script>',
- webpage, 'info json', flags=re.DOTALL))
-
- youtube_id = info.get('youtubeId')
- if youtube_id:
- return self.url_result(youtube_id, 'Youtube')
-
- formats = [{
- 'url': media['uri'] + '?' + info['AuthToken'],
- 'tbr': media['bitRate'],
- 'width': media['width'],
- 'height': media['height'],
- } for media in info['media']]
-
- if not formats:
+ display_id, video_id = re.match(self._VALID_URL, url).groups()
+
+ webpage = self._download_webpage(url, display_id)
+
+ youtube_url = YoutubeIE._extract_url(webpage)
+ if youtube_url:
+ return self.url_result(youtube_url, ie=YoutubeIE.ie_key())
+
+ content = self._parse_json(
+ self._search_regex(
+ r'(?s)content["\']\s*:\s*(\[.+?\])\s*[,\n]', webpage,
+ 'content'),
+ display_id)
+
+ formats = []
+ for video in content:
+ video_url = video.get('url')
+ if not video_url or not isinstance(video_url, compat_str):
+ continue
+ bitrate = int_or_none(self._search_regex(
+ r'(\d+)_kbps', video_url, 'tbr', default=None))