Skip to content

Commit

Permalink
[extractor/cbc] Ignore 426 from API (#6781)
Browse files Browse the repository at this point in the history
Closes #6716
Authored by: jo-nike
  • Loading branch information
jo-nike committed May 29, 2023
1 parent 5c14b21 commit 4afb208
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions yt_dlp/extractor/cbc.py
Expand Up @@ -351,7 +351,9 @@ def _find_secret_formats(self, formats, video_id):

def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._download_json('https://services.radio-canada.ca/ott/cbc-api/v2/assets/' + video_id, video_id)
video_info = self._download_json(
f'https://services.radio-canada.ca/ott/cbc-api/v2/assets/{video_id}',
video_id, expected_status=426)

email, password = self._get_login_info()
if email and password:
Expand Down Expand Up @@ -426,7 +428,7 @@ def _real_extract(self, url):
match = self._match_valid_url(url)
season_id = match.group('id')
show = match.group('show')
show_info = self._download_json(self._API_BASE + show, season_id)
show_info = self._download_json(self._API_BASE + show, season_id, expected_status=426)
season = int(match.group('season'))

season_info = next((s for s in show_info['seasons'] if s.get('season') == season), None)
Expand Down

0 comments on commit 4afb208

Please sign in to comment.