Hack Forums
[Python] Python Based Email Searcher - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Python Based Email Searcher (/showthread.php?tid=5074666)



Python Based Email Searcher - strangewolf - Nov 28, 2015

Hello All! I am new to these forums so please excuse my noob-like post. Anyway, I
have been on these forums for a while now and would like to see if anyone could help direct me on how to make a specific program. I want to create a program that can take a list of emails (or names) and search them on google. I want the results of the search to be saved to a folder and/or opened on a new tab(s). Essentially, I want the program to take a giant list of names, google them, then save the first page of relevant links. I believe Python would be the best language for this. However, I also believe Java could be a good alternative.

I know it might be a silly program but its something I really would like to try to do. If anyone has any links to relevant source code or any ideas please let me know. Again, Thank You for your help and support!


* - Nutar - Nov 29, 2015

You could easily use the HTML parsing functionalities provided by python to achieve this (using the HTMLParser module). I believe you could easily write a program that would load a text file and search for each name using a loop. But what I think will slow down the application is your actual internet speed.

I actually just searched for a random name on Google and it took me 0.96 seconds (according to google). So if you're looking to search for a thousand names that would take you an average of 16 minutes.


* - lockhead - Nov 30, 2015

What you're looking for is a webscraper. This is doable in both Python and Java. However if you don't have any programming experience, you be better off with Python, as it is easier to learn.
Search for Python webscraper on Google and HF. But you should probably learn the basics of Python first, if you're planning on doing this yourself.


* - strangewolf - Dec 17, 2015

Thank you for you help guys! I have been working on the program for a while. I ended up using Java, as I know it better. Hopefully, I will have something good and working soon! Thank you again.


* - Feanor - Dec 17, 2015

Here you go mate, I've not tested it out.

PHP Code

<?php 
from bs4 import BeautifulSoup
import urllib

def search
(email):
    return 
urllib.urlopen("https://www.google.co.uk/search?client=ubuntu&channel=fs&q=jj&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=CitzVu6tCMPS8Afy6pfgDQ#channel=fs&q=%s" %(email))

email_list = open('emails.txt', 'rb')

for 
email in email_list:
    
links = []
    
divider = "=================================================="
    
serch = search(email)
    
soup = BeautifulSoup(serch)
    for 
link in soup.find_all('a'):
        
links.append(link.get('href'))
    
with open('email_link.txt', 'a+') as output:
        
output.write("%s%s%s\n"%(email, links, divider)) 

with open('email_link.txt', 'rb') as output:
    for 
link in output:
        print 
link