#NEWLINE# @ staticmethod #NEWLINE# def search( query , num = 10 , start = 0 , sleep = True , recent = None , country_code = None ) : #NEWLINE# #INDENT# if sleep : #NEWLINE# #INDENT# wait ( 1 ) #NEWLINE# #UNINDENT# url = generate_url ( query , str ( num ) , str ( start ) , recent , country_code ) #NEWLINE# soup = BeautifulSoup ( requests . get ( url ) . text , 'html.parser' ) #NEWLINE# results = Google . scrape_search_result ( soup ) #NEWLINE# related_queries = Google . scrape_related ( soup ) #NEWLINE# raw_total_results = soup . find ( 'div' , attrs = { #NEWLINE# #INDENT# 'class' : 'sd' , #NEWLINE# #UNINDENT# } ) . string #NEWLINE# total_results = 0 #NEWLINE# if ( raw_total_results is not None ) : #NEWLINE# #INDENT# for i in raw_total_results : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# temp = int ( i ) #NEWLINE# total_results = ( ( total_results * 10 ) + temp ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# temp = { #NEWLINE# #INDENT# 'results' : results , #NEWLINE# 'url' : url , #NEWLINE# 'expected_num' : query , #NEWLINE# 'received_num' : len ( results ) , #NEWLINE# 'start' : start , #NEWLINE# 'search_engine' : 'google' , #NEWLINE# 'related_queries' : related_queries , #NEWLINE# 'total_results' : total_results , #NEWLINE# 'country_code' : country_code , #NEWLINE# #UNINDENT# } #NEWLINE# return temp