Raise `TranscriptsDisabled` if 'playerCaptionsTracklistRenderer' is not found (Fixes #136)

This commit is contained in:
Joshua Lochner 2021-11-29 18:25:14 +02:00
parent 904acaf153
commit bd8d8919b2
1 changed files with 3 additions and 1 deletions

View File

@ -60,7 +60,9 @@ class TranscriptListFetcher(object):
captions_json = json.loads( captions_json = json.loads(
splitted_html[1].split(',"videoDetails')[0].replace('\n', '') splitted_html[1].split(',"videoDetails')[0].replace('\n', '')
)['playerCaptionsTracklistRenderer'] ).get('playerCaptionsTracklistRenderer')
if captions_json is None:
raise TranscriptsDisabled(video_id)
if 'captionTracks' not in captions_json: if 'captionTracks' not in captions_json:
raise NoTranscriptAvailable(video_id) raise NoTranscriptAvailable(video_id)