Skip to content

Commit

Permalink
Return None if no synopsis is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
milouk committed Sep 30, 2024
1 parent 77203f8 commit 2351676
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 2351676

Please sign in to comment.