Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vrtnu] Requesting video info has new end-point requiring a new vrtPlayerToken. #18629

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions youtube_dl/extractor/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ 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={},
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')
Expand All @@ -52,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))
Expand Down Expand Up @@ -202,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,
Expand Down