Google-Search-API icon indicating copy to clipboard operation
Google-Search-API copied to clipboard

How to show "missing" in search results?

Open pengyu opened this issue 7 years ago • 1 comments

Sometimes, google will show results even when some keywords are missing. Is there a way to show such information in the search results?

from google import google
num_page = 1
search_results = google.search('Robert V Martinez thermogenesis', num_page)

In the above, https://en.wikipedia.org/wiki/Bob_Martinez will be returned but thermogenesis is shown as missing.

pengyu avatar Jul 21 '17 17:07 pengyu

I am seeing that this feed is quite old but unsolved. Pretty likely you have already solved it.

Assuming you haven't here:

from google import google
num_page = 1
search_query = 'Robert V Martinez thermogenesis'
search_results = google.search(query= search_query, pages= num_page)
words = search_query.split()
missing_wrds = []

for search_result in search_results:
	missing = []
	for word in words:
		if (word not in search_result.name) and (word not in search_result.description):
		#I am assuming these are the places you are going to look for
			missing.append(word)
	missing_wrds.append(missing)

print(missing_wrds)

sansmoraxz avatar Feb 18 '18 15:02 sansmoraxz