2 from __future__ import unicode_literals
7 from .common import InfoExtractor
10 class CloudflareStreamIE(InfoExtractor):
11 _DOMAIN_RE = r'(?:cloudflarestream\.com|(?:videodelivery|bytehighway)\.net)'
16 embed\.%s/embed/[^/]+\.js\?.*?\bvideo=
18 (?P<id>[\da-f]{32}|[\w-]+\.[\w-]+\.[\w-]+)
19 ''' % (_DOMAIN_RE, _DOMAIN_RE)
21 'url': 'https://embed.cloudflarestream.com/embed/we4g.fla9.latest.js?video=31c9291ab41fac05471db4e73aa11717',
23 'id': '31c9291ab41fac05471db4e73aa11717',
25 'title': '31c9291ab41fac05471db4e73aa11717',
28 'skip_download': True,
31 'url': 'https://watch.cloudflarestream.com/9df17203414fd1db3e3ed74abbe936c1',
32 'only_matching': True,
34 'url': 'https://cloudflarestream.com/31c9291ab41fac05471db4e73aa11717/manifest/video.mpd',
35 'only_matching': True,
37 'url': 'https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=81d80727f3022488598f68d323c1ad5e',
38 'only_matching': True,
42 def _extract_urls(webpage):
45 for mobj in re.finditer(
46 r'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//embed\.(?:cloudflarestream\.com|videodelivery\.net)/embed/[^/]+\.js\?.*?\bvideo=[\da-f]+?.*?)\1',
49 def _real_extract(self, url):
50 video_id = self._match_id(url)
51 domain = 'bytehighway.net' if 'bytehighway.net/' in url else 'videodelivery.net'
52 base_url = 'https://%s/%s/' % (domain, video_id)
54 video_id = self._parse_json(base64.urlsafe_b64decode(
55 video_id.split('.')[1]), video_id)['sub']
56 manifest_base_url = base_url + 'manifest/video.'
58 formats = self._extract_m3u8_formats(
59 manifest_base_url + 'm3u8', video_id, 'mp4',
60 'm3u8_native', m3u8_id='hls', fatal=False)
61 formats.extend(self._extract_mpd_formats(
62 manifest_base_url + 'mpd', video_id, mpd_id='dash', fatal=False))
63 self._sort_formats(formats)
68 'thumbnail': base_url + 'thumbnails/thumbnail.jpg',