diff options
author | Aakash Gajjar <skyqutip@gmail.com> | 2020-08-26 20:22:32 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-26 20:22:32 +0530 |
commit | 19a107f21c7544b5e49a58040d09d9465f6858b1 (patch) | |
tree | 8325ffd206d9da1ce53f24b9ab4690abe175144d /youtube_dl/extractor/cloudflarestream.py | |
parent | 7f7edf837c1af059f64a4968b942a83f86cf6206 (diff) | |
download | hypervideo-pre-19a107f21c7544b5e49a58040d09d9465f6858b1.tar.lz hypervideo-pre-19a107f21c7544b5e49a58040d09d9465f6858b1.tar.xz hypervideo-pre-19a107f21c7544b5e49a58040d09d9465f6858b1.zip |
Revert "pull changes from remote master (#190)" (#193)
This reverts commit b827ee921fe510a8730a9fab070148ed2b8279b5.
Diffstat (limited to 'youtube_dl/extractor/cloudflarestream.py')
-rw-r--r-- | youtube_dl/extractor/cloudflarestream.py | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/youtube_dl/extractor/cloudflarestream.py b/youtube_dl/extractor/cloudflarestream.py index 2fdcfbb3a..8ff2c6531 100644 --- a/youtube_dl/extractor/cloudflarestream.py +++ b/youtube_dl/extractor/cloudflarestream.py @@ -1,24 +1,20 @@ # coding: utf-8 from __future__ import unicode_literals -import base64 import re from .common import InfoExtractor class CloudflareStreamIE(InfoExtractor): - _DOMAIN_RE = r'(?:cloudflarestream\.com|(?:videodelivery|bytehighway)\.net)' - _EMBED_RE = r'embed\.%s/embed/[^/]+\.js\?.*?\bvideo=' % _DOMAIN_RE - _ID_RE = r'[\da-f]{32}|[\w-]+\.[\w-]+\.[\w-]+' _VALID_URL = r'''(?x) https?:// (?: - (?:watch\.)?%s/| - %s + (?:watch\.)?(?:cloudflarestream\.com|videodelivery\.net)/| + embed\.(?:cloudflarestream\.com|videodelivery\.net)/embed/[^/]+\.js\?.*?\bvideo= ) - (?P<id>%s) - ''' % (_DOMAIN_RE, _EMBED_RE, _ID_RE) + (?P<id>[\da-f]+) + ''' _TESTS = [{ 'url': 'https://embed.cloudflarestream.com/embed/we4g.fla9.latest.js?video=31c9291ab41fac05471db4e73aa11717', 'info_dict': { @@ -45,28 +41,23 @@ class CloudflareStreamIE(InfoExtractor): return [ mobj.group('url') for mobj in re.finditer( - r'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//%s(?:%s).*?)\1' % (CloudflareStreamIE._EMBED_RE, CloudflareStreamIE._ID_RE), + r'<script[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//embed\.(?:cloudflarestream\.com|videodelivery\.net)/embed/[^/]+\.js\?.*?\bvideo=[\da-f]+?.*?)\1', 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'] - manifest_base_url = base_url + 'manifest/video.' formats = self._extract_m3u8_formats( - manifest_base_url + 'm3u8', video_id, 'mp4', - 'm3u8_native', m3u8_id='hls', fatal=False) + 'https://cloudflarestream.com/%s/manifest/video.m3u8' % video_id, + video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', + fatal=False) formats.extend(self._extract_mpd_formats( - manifest_base_url + 'mpd', video_id, mpd_id='dash', fatal=False)) + 'https://cloudflarestream.com/%s/manifest/video.mpd' % video_id, + video_id, mpd_id='dash', fatal=False)) self._sort_formats(formats) return { 'id': video_id, 'title': video_id, - 'thumbnail': base_url + 'thumbnails/thumbnail.jpg', 'formats': formats, } |