Esempio n. 1
0
def get_googleResult_from_allExpandedQuery(combinedQueryList):
#""" Input: query String (which_query) from google-search bar output: get the list of JSONs """
	allJSON = {}
	for q in combinedQueryList:
		queryResult = ModifiedGoogleSearch.pygoogle(q)
		allJSON[q] = queryResult.containerForAllData
		#print '*Found %s results*'%(firstQuery.get_result_count())
	#set_original_googleResultToSql(firstQuery)
	
	return allJSON
Esempio n. 2
0
def get_googleResult_from_firstQuery(userQuery, multipleQuery = False):
	if multipleQuery == False:
#""" Input: query String (which_query) from google-search bar """
# output: a list of JSONs containing each page result FOR ONE QUERY [[ONE PAGE - JSON],[ONE PAGE - JSON]]
		firstQuery = ModifiedGoogleSearch.pygoogle(userQuery)
		firstQuery.pages = 1
		firstQuery.display_results()
		print '*Found %s results*'%(firstQuery.get_result_count())
		#set_original_googleResultToSql(firstQuery)
		return firstQuery.containerForAllData
Esempio n. 3
0
def get_googleResult_forServer(userQuery, multipleQuery = False):
	if multipleQuery == False:
#""" Input: query String (which_query) from google-search bar """
# output: a list of JSONs containing each page result FOR ONE QUERY [[ONE PAGE - JSON],[ONE PAGE - JSON]]
		firstQuery = ModifiedGoogleSearch.pygoogle(userQuery)
		failedQuery = userQuery
		firstQuery.pages = 3
		firstQuery.display_results()
		if firstQuery.found:
			failedQuery = None
		return firstQuery.containerForAllData, firstQuery.found, failedQuery # temp ver for one page 
Esempio n. 4
0
def get_googleResult_forClient(userQuery, multipleQuery = False):
	if multipleQuery == False:
#""" Input: query String (which_query) from google-search bar """
# output: a list of JSONs containing each page result FOR ONE QUERY [[ONE PAGE - JSON],[ONE PAGE - JSON]]
		firstQuery = ModifiedGoogleSearch.pygoogle(userQuery)
		failedQuery = userQuery
		firstQuery.pages = 3
		firstQuery.display_results()
		#print '*Found %s results*'%(firstQuery.get_result_count())
		#set_original_googleResultToSql(firstQuery)
		#return firstQuery.containerForAllData, firstQuery.containerForFailedData # return if not 200, and reply the list of the failed queries.
		if firstQuery.found:
			failedQuery = None
		return firstQuery.containerForAllData, firstQuery.found, failedQuery # temp ver for one page