@@ -33,7 +33,7 @@ def find_keywords_in_pdfs(ps_docs_path, keywords: list) -> dict:
33
33
print (Fore .RED + f"Can't find keywords. Reason: { e } " )
34
34
pass
35
35
36
- def subdomains_parser (subdomains_list , report_folder , keywords ):
36
+ def subdomains_parser (subdomains_list , report_folder , keywords , keywords_flag ):
37
37
ps_docs_path = report_folder + '//ps_documents'
38
38
if not os .path .exists (ps_docs_path ):
39
39
os .makedirs (ps_docs_path )
@@ -118,10 +118,14 @@ def subdomains_parser(subdomains_list, report_folder, keywords):
118
118
print (Fore .RED + "File extraction failed. Reason: {}" .format (e ) + Style .RESET_ALL )
119
119
print (Fore .LIGHTGREEN_EX + "-------------------------------------------------" )
120
120
pass
121
- try :
122
- pdf_results = find_keywords_in_pdfs (ps_docs_path , keywords )
123
- for pdf_file , found_keywords in pdf_results .items ():
124
- print (Fore .GREEN + f"Keywords " + Fore .RESET + f"{ ', ' .join (found_keywords )} " + Fore .GREEN + f" found in '{ pdf_file } '" )
125
- except Exception as e :
126
- print (Fore .RED + f"Can't find keywords. Reason: { e } " )
121
+ if keywords_flag == 1 :
122
+ print (Fore .GREEN + "Starting keywords searching..." + Style .RESET_ALL )
123
+ try :
124
+ pdf_results = find_keywords_in_pdfs (ps_docs_path , keywords )
125
+ for pdf_file , found_keywords in pdf_results .items ():
126
+ print (Fore .GREEN + f"Keywords " + Fore .RESET + f"{ ', ' .join (found_keywords )} " + Fore .GREEN + f" found in '{ pdf_file } '" )
127
+ except Exception as e :
128
+ print (Fore .RED + f"Can't find keywords. Reason: { e } " )
129
+ elif keywords_flag == 0 :
130
+ print (Fore .RED + "Keywords gathering won't start because of None user input" + Style .RESET_ALL )
127
131
print (Fore .LIGHTGREEN_EX + "-------------------------------------------------" )
0 commit comments