0

I am trying to make a function that takes in potential email addresses and searches them on google and produces a true value if it finds the exact email address in the website. The code would take in an email address like these listed below and search each one and if it finds an exact match on google produces the true value for that email.

['Jane.Doe@gmail.com',
 'JaneDoe@gmail.com',
 'Jane@gmail.com',
 'JaneD@gmail.com',
 'JDoe@gmail.com',
 'DoeJ@gmail.com',
 'DoeJa@gmail.com']

I have found some code that does the google search part, but I want it to only produce true or show results if the email address is exactly the same. Currently, I will produce results that are just the name of the person or not the email iteration that I search for specifically. I am not sure if this is possible, but any suggestions would be greatly appreciated. The search code is listed below.

try: 
    from googlesearch import search 
except ImportError:  
    print("No module named 'google' found") 
  
# to search 
query = "some_email@gmail.com"
  
for j in search(query, tld="co.in", num=10, stop=10, pause=2): 
    print(j) 

1 Answers1

0

The code snippet you have posted simply searches the email id on Google and return the links to the results.

from googlesearch import search 

query = "Jane.Doe@gmail.com"
  
for j in search(query, tld="co.in", num=10, stop=10, pause=2): 
    print(j)  

# output of code for Jane.Doe@gmail.com
https://cleantalk.org/blacklists/janedoe@gmail.com
https://www.emailsherlock.com/emailsearch/janedoe@gmail.com/
https://www.emailsherlock.com/emailsearch/jane.doe@gmail.com/
https://www.youbemom.com/forum/permalink/671726/annoying-gmail-issue-my-email-is-jane-doe-gmail-com-and-i-keep
https://github.com/naile/canonical-emails
https://www.gsb.stanford.edu/sites/gsb/files/Independent%20Consultant.pdf
https://twitter.com/slackhq/status/649217665735761920?lang=en
https://blog.gsmart.in/how-many-gmail-accounts-can-you-have/
https://www.lifewire.com/stop-people-from-finding-your-gmail-address-1171887
https://medium.com/edge-coders/two-simple-things-everyone-should-know-about-their-gmail-address-f48791a373a

This doesn't verify if the email-id actually exists or not. For example, if the webpage just mentions an email-id that matches the search then your code will suggest that it exists but the email-id might have been deleted later on so, I would suggest you take a look at this answer.