From 50666d402353e97a8e156271652eb398255ef29a Mon Sep 17 00:00:00 2001 From: user Date: Sun, 18 Feb 2024 21:17:11 +0300 Subject: [PATCH] In TwitchMonitor handle absense of game category correctly --- avtdl/plugins/twitch/twitch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/avtdl/plugins/twitch/twitch.py b/avtdl/plugins/twitch/twitch.py index c4f560b..6def5f6 100644 --- a/avtdl/plugins/twitch/twitch.py +++ b/avtdl/plugins/twitch/twitch.py @@ -89,7 +89,8 @@ async def check_channel(self, entity: TwitchMonitorEntity, session: aiohttp.Clie stream_id = stream_info['id'] start_text = stream_info['createdAt'] start = dateutil_parser.parse(start_text) - game = stream_info.get('game', {}).get('name', None) + game_info = stream_info.get('game') or {} + game = game_info.get('name', None) except (TypeError, IndexError, KeyError) as e: self.logger.debug(f'[{entity.name}] failed to parse response: {type(e)} {e}. Raw response: {response}') return None