zanegraper commited on
Commit
d2019da
·
1 Parent(s): 28a4d4e

Add initial files

Browse files
Files changed (3) hide show
  1. app.py +13 -0
  2. email_finder.py +12 -0
  3. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import gradio as gr
3
+ from email_finder import find_emails
4
+
5
+ iface = gr.Interface(
6
+ fn=find_emails,
7
+ inputs=gr.Textbox(label="Enter a Domain (e.g. example.com)"),
8
+ outputs=gr.Textbox(label="Extracted Emails"),
9
+ title="Email Finder",
10
+ description="An adaptive tool to extract public emails from a website using domain input."
11
+ )
12
+
13
+ iface.launch()
email_finder.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # email_finder.py
2
+ import requests
3
+ import re
4
+ def find_emails(domain):
5
+ url = f"https://{domain}"
6
+ try:
7
+ response = requests.get(url, timeout=10)
8
+ content = response.text
9
+ emails = set(re.findall(r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-z]{2,}", content))
10
+ return list(emails) if emails else ["No emails found."]
11
+ except Exception as e:
12
+ return [f"Error fetching domain: {e}"]
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ requests