Fix issue with downloading clips with no game set

issue #78
This commit is contained in:
Ivan Habunek 2022-02-05 09:49:17 +01:00
parent 0af472528d
commit b8aaa0c24c
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95

View File

@ -213,6 +213,7 @@ def get_clip_authenticated_url(slug, quality):
def _download_clip(slug, args):
print_out("<dim>Looking up clip...</dim>")
clip = twitch.get_clip(slug)
game = clip["game"]["name"] if clip["game"] else "Unknown"
if not clip:
raise ConsoleError("Clip '{}' not found".format(slug))
@ -220,7 +221,7 @@ def _download_clip(slug, args):
print_out("Found: <green>{}</green> by <yellow>{}</yellow>, playing <blue>{}</blue> ({})".format(
clip["title"],
clip["broadcaster"]["displayName"],
clip["game"]["name"],
game,
utils.format_duration(clip["durationSeconds"])
))