From 485061bb49e986fee665bec368645c5982a1a0ee Mon Sep 17 00:00:00 2001 From: nex Date: Thu, 1 Jun 2023 01:09:05 +0100 Subject: [PATCH] Fix missing key error in yt-dl --- cogs/other.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cogs/other.py b/cogs/other.py index 9ef30a0..9471ae3 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -143,11 +143,11 @@ class OtherCog(commands.Cog): "id": fmt["format_id"], "ext": fmt["ext"], "protocol": fmt["protocol"], - "acodec": fmt["acodec"], - "vcodec": fmt["vcodec"], - "resolution": fmt["resolution"], + "acodec": fmt.get("acodec", "?"), + "vcodec": fmt.get("vcodec", "?"), + "resolution": fmt.get("resolution", "?x?"), "filesize": fmt.get("filesize", float('inf')), - "format": fmt["format"], + "format": fmt.get("format", '?'), } for fmt in info["formats"] } @@ -928,7 +928,8 @@ class OtherCog(commands.Cog): title="Error", description="Invalid format %r. pass `list-formats:True` to see a list of formats." % _fmt, colour=discord.Colour.red() - ) + ), + delete_after=30 ) MAX_SIZE_MB = ctx.guild.filesize_limit / 1024 / 1024 @@ -1015,7 +1016,8 @@ class OtherCog(commands.Cog): title="Error", description=f"Download failed:\n```\n{e}\n```", colour=discord.Colour.red() - ) + ), + delete_after=30 ) else: embed = discord.Embed(