Don't fail if captions field is missing

This commit is contained in:
Cadence Ember 2021-04-10 12:50:18 +12:00
parent be8a2dad5f
commit 5125bb9461
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
1 changed files with 21 additions and 20 deletions

View File

@ -285,6 +285,7 @@ def get_more_stuff_from_file(id, result):
f["qualityLabel"] = label f["qualityLabel"] = label
f["second__order"] = format_order(f) f["second__order"] = format_order(f)
if "captions" in player_response:
for track in player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]: for track in player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]:
# safely editing the track format by taking apart the url... # safely editing the track format by taking apart the url...
url = track["baseUrl"] url = track["baseUrl"]