From 95a5c69fecc6d4acd2803e31bf58031bb481cbc8 Mon Sep 17 00:00:00 2001 From: yoshiko2 Date: Sat, 26 Nov 2022 05:11:39 +0800 Subject: [PATCH] Fix: If cover not found in other source, then skip using other sources using jadb cover --- scrapinglib/api.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scrapinglib/api.py b/scrapinglib/api.py index 831b288..ce4a5ee 100644 --- a/scrapinglib/api.py +++ b/scrapinglib/api.py @@ -177,13 +177,17 @@ class Scraping: # javdb的封面有水印,如果可以用其他源的封面来替换javdb的封面 if json_data['source'] == 'javdb': - other_sources = sources[sources.index('javdb') + 1:] # search other sources - json_data_other = self.searchAdult(number, other_sources) - if json_data_other is not None: - json_data['cover'] = json_data_other['cover'] - if self.debug: - print(f"[+]Find movie [{number}] cover on website '{json_data_other['cover']}'") + other_sources = sources[sources.index('javdb') + 1:] + # If cover not found in other source, then skip using other sources using javdb cover + try: + json_data_other = self.searchAdult(number, other_sources) + if json_data_other is not None: + json_data['cover'] = json_data_other['cover'] + if self.debug: + print(f"[+]Find movie [{number}] cover on website '{json_data_other['cover']}'") + except: + pass # Return if data not found in all sources if not json_data: