From 331aae07dd76047b82754e9cb714283a71ddc7f4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 27 Jul 2024 15:51:18 -0400 Subject: [PATCH] tmdb: skip empty overview --- catalog/sites/tmdb.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/catalog/sites/tmdb.py b/catalog/sites/tmdb.py index 3aac1577..b17b9ccf 100644 --- a/catalog/sites/tmdb.py +++ b/catalog/sites/tmdb.py @@ -92,7 +92,8 @@ def scrape(self): api_url = f"https://api.themoviedb.org/3/movie/{self.id_value}?api_key={settings.TMDB_API3_KEY}&language={lang_param}&append_to_response=external_ids,credits" res_data = BasicDownloader(api_url).download().json() localized_title.append({"lang": lang, "text": res_data["title"]}) - localized_desc.append({"lang": lang, "text": res_data["overview"]}) + if res_data.get("overview", "").strip(): + localized_desc.append({"lang": lang, "text": res_data["overview"]}) title = res_data["title"] orig_title = res_data["original_title"] year = ( @@ -198,7 +199,8 @@ def scrape(self): api_url = f"https://api.themoviedb.org/3/tv/{self.id_value}?api_key={settings.TMDB_API3_KEY}&language={lang_param}&append_to_response=external_ids,credits" res_data = BasicDownloader(api_url).download().json() localized_title.append({"lang": lang, "text": res_data["name"]}) - localized_desc.append({"lang": lang, "text": res_data["overview"]}) + if res_data.get("overview", "").strip(): + localized_desc.append({"lang": lang, "text": res_data["overview"]}) title = res_data["name"] orig_title = res_data["original_name"] @@ -318,7 +320,8 @@ def scrape(self): api_url = f"https://api.themoviedb.org/3/tv/{show_id}/season/{season_id}?api_key={settings.TMDB_API3_KEY}&language={lang_param}&append_to_response=external_ids,credits" res_data = BasicDownloader(api_url).download().json() localized_title.append({"lang": lang, "text": res_data["name"]}) - localized_desc.append({"lang": lang, "text": res_data["overview"]}) + if res_data.get("overview", "").strip(): + localized_desc.append({"lang": lang, "text": res_data["overview"]}) if not res_data.get("id"): raise ParseError(self, "id") d = res_data