From 62afac706063a6c81a0c2cc169d5a476f04e5780 Mon Sep 17 00:00:00 2001 From: ducklet Date: Sun, 23 Oct 2022 14:16:47 +0200 Subject: [PATCH] fix parsing of ratings listing with missing genres --- unwind/imdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unwind/imdb.py b/unwind/imdb.py index 5159fa9..e541277 100644 --- a/unwind/imdb.py +++ b/unwind/imdb.py @@ -99,9 +99,10 @@ find_movie_id = re.compile(r"/title/(?Ptt\d+)/").search def movie_and_rating_from_item(item) -> tuple[Movie, Rating]: + genres = (genre := item.find("span", "genre")) and genre.string or "" movie = Movie( title=item.h3.a.string.strip(), - genres=set(s.strip() for s in item.find("span", "genre").string.split(",")), + genres=set(s.strip() for s in genres.split(",")), ) episode_br = item.h3.br