From 961b9544d0df2b83d907e5df7dd61da638d9eb8c Mon Sep 17 00:00:00 2001 From: yoshiko2 Date: Sun, 7 May 2023 22:11:52 +0800 Subject: [PATCH] Change error output in Debug mode --- scrapinglib/api.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/scrapinglib/api.py b/scrapinglib/api.py index 2e3e642..e5325fd 100644 --- a/scrapinglib/api.py +++ b/scrapinglib/api.py @@ -90,9 +90,8 @@ class Scraping: continue json_data = json.loads(data) except Exception as e: - print('[!] 出错啦') - print(e) - pass + if config.getInstance().debug(): + print(e) # if any service return a valid return, break if self.get_data_state(json_data): if self.debug: @@ -102,8 +101,7 @@ class Scraping: continue # Return if data not found in all sources - if not json_data: - print(f'[-]Movie Number [{name}] not found!') + if not json_data or json_data['title'] == "": return None # If actor is anonymous, Fill in Anonymous @@ -137,9 +135,8 @@ class Scraping: continue json_data = json.loads(data) except Exception as e: - print('[!] 出错啦') - print(e) - pass + if config.getInstance().debug(): + print(e) # json_data = self.func_mapping[source](number, self) # if any service return a valid return, break if self.get_data_state(json_data): @@ -171,8 +168,7 @@ class Scraping: pass # Return if data not found in all sources - if not json_data: - print(f'[-]Movie Number [{number}] not found!') + if not json_data or json_data['title'] == "": return None # If actor is anonymous, Fill in Anonymous