From 2351676ef61d7a5fc25eb227c8de899110cd2514 Mon Sep 17 00:00:00 2001 From: Michael Loukeris Date: Mon, 30 Sep 2024 23:38:17 +0300 Subject: [PATCH] Return None if no synopsis is returned --- src/scraper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scraper.py b/src/scraper.py index f1dc823..9c0e031 100644 --- a/src/scraper.py +++ b/src/scraper.py @@ -189,10 +189,12 @@ def fetch_media(medias, properties, regions): return box, preview -def fetch_synopsis(game, config_media): - synopsis = game["response"]["jeu"]["synopsis"] +def fetch_synopsis(game, config): + synopsis = game["response"]["jeu"].get("synopsis") + if not synopsis: + return None - synopsis_lang = config_media["synopsis_lang"] + synopsis_lang = config["synopsis_lang"] synopsis_text = next( (item["text"] for item in synopsis if item["langue"] == synopsis_lang), None )