diff options
Diffstat (limited to 'hypervideo_dl/extractor/cloudflarestream.py')
-rw-r--r-- | hypervideo_dl/extractor/cloudflarestream.py | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/hypervideo_dl/extractor/cloudflarestream.py b/hypervideo_dl/extractor/cloudflarestream.py index 2fdcfbb..748e8e9 100644 --- a/hypervideo_dl/extractor/cloudflarestream.py +++ b/hypervideo_dl/extractor/cloudflarestream.py @@ -1,8 +1,4 @@ -# coding: utf-8 -from __future__ import unicode_literals - import base64 -import re from .common import InfoExtractor @@ -19,6 +15,7 @@ class CloudflareStreamIE(InfoExtractor): ) (?P<id>%s) ''' % (_DOMAIN_RE, _EMBED_RE, _ID_RE) + _EMBED_REGEX = [fr'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//{_EMBED_RE}(?:{_ID_RE}).*?)\1'] _TESTS = [{ 'url': 'https://embed.cloudflarestream.com/embed/we4g.fla9.latest.js?video=31c9291ab41fac05471db4e73aa11717', 'info_dict': { @@ -40,21 +37,13 @@ class CloudflareStreamIE(InfoExtractor): 'only_matching': True, }] - @staticmethod - def _extract_urls(webpage): - return [ - mobj.group('url') - for mobj in re.finditer( - r'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//%s(?:%s).*?)\1' % (CloudflareStreamIE._EMBED_RE, CloudflareStreamIE._ID_RE), - webpage)] - def _real_extract(self, url): video_id = self._match_id(url) domain = 'bytehighway.net' if 'bytehighway.net/' in url else 'videodelivery.net' base_url = 'https://%s/%s/' % (domain, video_id) if '.' in video_id: video_id = self._parse_json(base64.urlsafe_b64decode( - video_id.split('.')[1]), video_id)['sub'] + video_id.split('.')[1] + '==='), video_id)['sub'] manifest_base_url = base_url + 'manifest/video.' formats = self._extract_m3u8_formats( @@ -62,7 +51,6 @@ class CloudflareStreamIE(InfoExtractor): 'm3u8_native', m3u8_id='hls', fatal=False) formats.extend(self._extract_mpd_formats( manifest_base_url + 'mpd', video_id, mpd_id='dash', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, |