From b96b5689b6e1b8b19217b2ed16503e00d95e6528 Mon Sep 17 00:00:00 2001 From: Peter Makholm Date: Thu, 18 Jul 2024 12:39:39 +0000 Subject: [PATCH 1/2] Default to imdb scraper on exceptions in tmdb scraper --- catalog/sites/imdb.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/catalog/sites/imdb.py b/catalog/sites/imdb.py index 60f6d62b..c3d0eb16 100644 --- a/catalog/sites/imdb.py +++ b/catalog/sites/imdb.py @@ -32,7 +32,12 @@ def id_to_url(cls, id_value): return "https://www.imdb.com/title/" + id_value + "/" def scrape(self): - res_data = search_tmdb_by_imdb_id(self.id_value) + res_data = {} + try: + res_data = search_tmdb_by_imdb_id(self.id_value) + except: + pass + url = None pd = None if ( From 9125cdcacccf2007562f26c1c3f5b8f265aa3df9 Mon Sep 17 00:00:00 2001 From: Peter Makholm Date: Thu, 18 Jul 2024 12:40:06 +0000 Subject: [PATCH 2/2] Get plaintext attribute of plotText --- catalog/sites/imdb.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/catalog/sites/imdb.py b/catalog/sites/imdb.py index c3d0eb16..66a07111 100644 --- a/catalog/sites/imdb.py +++ b/catalog/sites/imdb.py @@ -91,7 +91,9 @@ def scrape_imdb(self): "genre": ( [x["text"] for x in d["genres"]["genres"]] if d.get("genres") else [] ), - "brief": d["plot"].get("plotText") if d.get("plot") else None, + "brief": ( + d["plot"].get("plotText").get("plainText") if d.get("plot") else None + ), "cover_image_url": ( d["primaryImage"].get("url") if d.get("primaryImage") else None ),