From 8d8015f6849a47218c72eb1943eee9b2e9848b0b Mon Sep 17 00:00:00 2001 From: Twilkie Date: Tue, 25 Dec 2018 00:03:16 +0100 Subject: [PATCH 1/4] Requesting video info has new end-point requiring a new vrtPlayerToken. --- youtube_dl/extractor/canvas.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/canvas.py b/youtube_dl/extractor/canvas.py index 174fd9e2b4b..b088df8800c 100644 --- a/youtube_dl/extractor/canvas.py +++ b/youtube_dl/extractor/canvas.py @@ -40,9 +40,14 @@ def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) site_id, video_id = mobj.group('site_id'), mobj.group('id') + token = self._download_json('https://media-services-public.vrt.be/vualto-video-aggregator-web/' + 'rest/external/v1/tokens', None, data={}, + headers={"accept": "*/*", "content-type": "application/json", "method": "POST"}) + vrtPlayerToken = token.get('vrtPlayerToken') + data = self._download_json( - 'https://mediazone.vrt.be/api/v1/%s/assets/%s' - % (site_id, video_id), video_id) + 'https://media-services-public.vrt.be/vualto-video-aggregator-web/rest/external/v1/videos/%s?vrtPlayerToken=%s&client=vrtvideo' + % (video_id, vrtPlayerToken), video_id) title = data['title'] description = data.get('description') From 5eac3800d8685ce3ed371e6322071018b1de1566 Mon Sep 17 00:00:00 2001 From: Twilkie Date: Tue, 25 Dec 2018 11:25:00 +0100 Subject: [PATCH 2/4] Format type case changed, fix --- youtube_dl/extractor/canvas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/canvas.py b/youtube_dl/extractor/canvas.py index b088df8800c..e57b72fa8a2 100644 --- a/youtube_dl/extractor/canvas.py +++ b/youtube_dl/extractor/canvas.py @@ -57,7 +57,7 @@ def _real_extract(self, url): format_url, format_type = target.get('url'), target.get('type') if not format_url or not format_type: continue - if format_type == 'HLS': + if format_type == 'HLS' or format_type == 'hls': formats.extend(self._extract_m3u8_formats( format_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id=format_type, fatal=False)) From e58e4111c4514b8f87a96ae129ddc0aa90b2f74c Mon Sep 17 00:00:00 2001 From: Twilkie Date: Fri, 28 Dec 2018 15:04:49 +0100 Subject: [PATCH 3/4] Removed unused site_id, flake8 suggestion --- youtube_dl/extractor/canvas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/canvas.py b/youtube_dl/extractor/canvas.py index e57b72fa8a2..73d282bb221 100644 --- a/youtube_dl/extractor/canvas.py +++ b/youtube_dl/extractor/canvas.py @@ -38,7 +38,7 @@ class CanvasIE(InfoExtractor): def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - site_id, video_id = mobj.group('site_id'), mobj.group('id') + video_id = mobj.group('id') token = self._download_json('https://media-services-public.vrt.be/vualto-video-aggregator-web/' 'rest/external/v1/tokens', None, data={}, From 5b00b954c60419253ae1c65102f8d08c3a3ca24a Mon Sep 17 00:00:00 2001 From: Twilkie Date: Fri, 28 Dec 2018 16:45:07 +0100 Subject: [PATCH 4/4] Fetching meta-data about episode required user logging in, raise error if user didn't provide credentials --- youtube_dl/extractor/canvas.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/canvas.py b/youtube_dl/extractor/canvas.py index 73d282bb221..c5d0e7a9afe 100644 --- a/youtube_dl/extractor/canvas.py +++ b/youtube_dl/extractor/canvas.py @@ -207,8 +207,9 @@ def _real_initialize(self): def _login(self): username, password = self._get_login_info() - if username is None: - return + + if username is None or password is None: + self.raise_login_required() auth_data = { 'APIKey': self._APIKEY,