mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Fix video output when creator is not set
This commit is contained in:
parent
52651e62c8
commit
b73ab58432
@ -71,19 +71,19 @@ def print_log(*args, **kwargs):
|
|||||||
def print_video(video):
|
def print_video(video):
|
||||||
published_at = video["publishedAt"].replace("T", " @ ").replace("Z", "")
|
published_at = video["publishedAt"].replace("T", " @ ").replace("Z", "")
|
||||||
length = utils.format_duration(video["lengthSeconds"])
|
length = utils.format_duration(video["lengthSeconds"])
|
||||||
channel = video["creator"]["displayName"]
|
|
||||||
|
|
||||||
playing = (
|
channel = "<blue>{}</blue>".format(video["creator"]["displayName"]) if video["creator"] else ""
|
||||||
"playing <blue>{}</blue>".format(video["game"]["name"])
|
playing = "playing <blue>{}</blue>".format(video["game"]["name"]) if video["game"] else ""
|
||||||
if video["game"] else ""
|
|
||||||
)
|
|
||||||
|
|
||||||
# Can't find URL in video object, strange
|
# Can't find URL in video object, strange
|
||||||
url = "https://www.twitch.tv/videos/{}".format(video["id"])
|
url = "https://www.twitch.tv/videos/{}".format(video["id"])
|
||||||
|
|
||||||
print_out("<b>Video {}</b>".format(video["id"]))
|
print_out("<b>Video {}</b>".format(video["id"]))
|
||||||
print_out("<green>{}</green>".format(video["title"]))
|
print_out("<green>{}</green>".format(video["title"]))
|
||||||
print_out("<blue>{}</blue> {}".format(channel, playing))
|
|
||||||
|
if channel or playing:
|
||||||
|
print_out(" ".join([channel, playing]))
|
||||||
|
|
||||||
print_out("Published <blue>{}</blue> Length: <blue>{}</blue> ".format(published_at, length))
|
print_out("Published <blue>{}</blue> Length: <blue>{}</blue> ".format(published_at, length))
|
||||||
print_out("<i>{}</i>".format(url))
|
print_out("<i>{}</i>".format(url))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user