2 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 class CloudflareStreamIE(InfoExtractor):
13 (?:watch\.)?(?:cloudflarestream\.com|videodelivery\.net)/|
14 embed\.(?:cloudflarestream\.com|videodelivery\.net)/embed/[^/]+\.js\?.*?\bvideo=
19 'url': 'https://embed.cloudflarestream.com/embed/we4g.fla9.latest.js?video=31c9291ab41fac05471db4e73aa11717',
21 'id': '31c9291ab41fac05471db4e73aa11717',
23 'title': '31c9291ab41fac05471db4e73aa11717',
26 'skip_download': True,
29 'url': 'https://watch.cloudflarestream.com/9df17203414fd1db3e3ed74abbe936c1',
30 'only_matching': True,
32 'url': 'https://cloudflarestream.com/31c9291ab41fac05471db4e73aa11717/manifest/video.mpd',
33 'only_matching': True,
35 'url': 'https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=81d80727f3022488598f68d323c1ad5e',
36 'only_matching': True,
40 def _extract_urls(webpage):
43 for mobj in re.finditer(
44 r'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//embed\.(?:cloudflarestream\.com|videodelivery\.net)/embed/[^/]+\.js\?.*?\bvideo=[\da-f]+?.*?)\1',
47 def _real_extract(self, url):
48 video_id = self._match_id(url)
50 formats = self._extract_m3u8_formats(
51 'https://cloudflarestream.com/%s/manifest/video.m3u8' % video_id,
52 video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls',
54 formats.extend(self._extract_mpd_formats(
55 'https://cloudflarestream.com/%s/manifest/video.mpd' % video_id,
56 video_id, mpd_id='dash', fatal=False))
57 self._sort_formats(formats)