55"""
66from result import QueryStatus
77from colorama import Fore , Style
8+ import webbrowser
89globvar = 0 # global variable to count the number of results.
910
1011class QueryNotify :
@@ -109,7 +110,7 @@ class QueryNotifyPrint(QueryNotify):
109110 Query notify class that prints results.
110111 """
111112
112- def __init__ (self , result = None , verbose = False , print_all = False ):
113+ def __init__ (self , result = None , verbose = False , print_all = False , browse = False ):
113114 """Create Query Notify Print Object.
114115
115116 Contains information about a specific method of notifying the results
@@ -121,6 +122,7 @@ def __init__(self, result=None, verbose=False, print_all=False):
121122 results for this query.
122123 verbose -- Boolean indicating whether to give verbose output.
123124 print_all -- Boolean indicating whether to only print all sites, including not found.
125+ browse -- Boolean indicating whether to open found sites in a web browser.
124126
125127 Return Value:
126128 Nothing.
@@ -129,6 +131,7 @@ def __init__(self, result=None, verbose=False, print_all=False):
129131 super ().__init__ (result )
130132 self .verbose = verbose
131133 self .print_all = print_all
134+ self .browse = browse
132135
133136 return
134137
@@ -227,7 +230,9 @@ def update(self, result):
227230 Fore .GREEN +
228231 f" { self .result .site_name } : " +
229232 Style .RESET_ALL +
230- f"{ self .result .site_url_user } " )
233+ f"{ self .result .site_url_user } " )
234+ if self .browse :
235+ webbrowser .open (self .result .site_url_user ,2 )
231236
232237 elif result .status == QueryStatus .AVAILABLE :
233238 if self .print_all :
0 commit comments