2 from __future__ import unicode_literals
5 from .common import InfoExtractor
8 class RedBullIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?redbull\.tv/video/(?P<id>AP-\w+)'
11 'url': 'https://www.redbull.tv/video/AP-1Q756YYX51W11/abc-of-wrc',
12 'md5': '78e860f631d7a846e712fab8c5fe2c38',
14 'id': 'AP-1Q756YYX51W11',
16 'title': 'ABC of...WRC',
17 'description': 'Buckle up for a crash course in the terminology, rules, drivers, and courses of the World Rally Championship.'
21 def _real_extract(self, url):
22 mobj = re.match(self._VALID_URL, url)
23 video_id = mobj.group('id')
25 access_token = self._download_json(
26 'http://api-v2.redbull.tv/start?build=4.0.9&category=smartphone&os_version=23&os_family=android',
27 video_id, note='Downloading access token',
28 )['auth']['access_token']
30 info = self._download_json(
31 'https://api-v2.redbull.tv/views/%s' % video_id,
32 video_id, note='Downloading video information',
33 headers={'Authorization': 'Bearer ' + access_token}
34 )['blocks'][0]['top'][0]
36 m3u8_url = info['video_product']['url']
39 formats = self._extract_m3u8_formats(
40 m3u8_url, video_id, 'mp4', 'm3u8_native',
47 'description': info.get('short_description'),
48 'genre': info.get('genre'),
49 'duration': info.get('duration')