diff --git a/scrapinglib/api.py b/scrapinglib/api.py index dace413..d520e78 100644 --- a/scrapinglib/api.py +++ b/scrapinglib/api.py @@ -179,15 +179,19 @@ class Scraping: if 'source' in json_data and json_data['source'] == 'javdb': # search other sources 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 + while other_sources: + # If cover not found in other source, then skip using other sources using javdb cover instead + try: + json_data_other = self.searchAdult(number, other_sources) + if json_data_other is not None and json_data_other['cover'] != '': + json_data['cover'] = json_data_other['cover'] + if self.debug: + print(f"[+]Find movie [{number}] cover on website '{json_data_other['cover']}'") + break + # check other sources + other_sources = sources[sources.index(json_data_other['source']) + 1:] + except: + pass # Return if data not found in all sources if not json_data: