0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-16 01:25:06 +00:00

[CBC Gem] Fix for shows that don't have all seasons (#1621)

Closes #1594
Authored by: makeworld-the-better-one
This commit is contained in:
makeworld 2021-11-10 14:37:05 -05:00 committed by GitHub
parent b47d236d72
commit 013ae2e503
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -390,7 +390,8 @@ def _real_extract(self, url):
show = match.group('show') 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)
season = int(match.group('season')) season = int(match.group('season'))
season_info = try_get(show_info, lambda x: x['seasons'][season - 1])
season_info = next((s for s in show_info['seasons'] if s.get('season') == season), None)
if season_info is None: if season_info is None:
raise ExtractorError(f'Couldn\'t find season {season} of {show}') raise ExtractorError(f'Couldn\'t find season {season} of {show}')