Spaces:
Runtime error
Runtime error
Commit ·
0159c5b
1
Parent(s): 26082dc
Added features
Browse files- app.py +14 -4
- combined_email_finder.py +18 -0
app.py
CHANGED
|
@@ -1,11 +1,21 @@
|
|
| 1 |
# app.py
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
gr.Interface(
|
| 6 |
-
fn=
|
| 7 |
inputs=gr.Textbox(label="Enter a Domain (e.g. example.com)"),
|
| 8 |
-
outputs=gr.
|
| 9 |
title="AI-Powered EmailFinder (Search Engine Scraper)",
|
| 10 |
-
description="Uses
|
|
|
|
| 11 |
).launch()
|
|
|
|
| 1 |
# app.py
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
+
import pandas as pd
|
| 5 |
+
from combined_email_finder import get_emails_with_feedback
|
| 6 |
+
|
| 7 |
+
def get_results_csv(domain):
|
| 8 |
+
emails = get_emails_with_feedback(domain)
|
| 9 |
+
df = pd.DataFrame({"Email": emails})
|
| 10 |
+
csv_path = "emails.csv"
|
| 11 |
+
df.to_csv(csv_path, index=False)
|
| 12 |
+
return csv_path
|
| 13 |
|
| 14 |
gr.Interface(
|
| 15 |
+
fn=get_results_csv,
|
| 16 |
inputs=gr.Textbox(label="Enter a Domain (e.g. example.com)"),
|
| 17 |
+
outputs=gr.File(label="Download CSV of Emails"),
|
| 18 |
title="AI-Powered EmailFinder (Search Engine Scraper)",
|
| 19 |
+
description="Uses both live webpage scraping and search engine techniques (via EmailFinder) to extract emails from a domain.",
|
| 20 |
+
live=True
|
| 21 |
).launch()
|
combined_email_finder.py
CHANGED
|
@@ -47,6 +47,24 @@ def get_combined_emails(domain):
|
|
| 47 |
valid_emails = filter_emails(all_emails)
|
| 48 |
return valid_emails or ["No emails found."]
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
if __name__ == "__main__":
|
| 51 |
emails = get_combined_emails("gunvorgroup.com")
|
| 52 |
print("Found emails:")
|
|
|
|
| 47 |
valid_emails = filter_emails(all_emails)
|
| 48 |
return valid_emails or ["No emails found."]
|
| 49 |
|
| 50 |
+
# DYNAMIC FEEDBACK
|
| 51 |
+
|
| 52 |
+
def get_emails_with_feedback(domain):
|
| 53 |
+
import time
|
| 54 |
+
|
| 55 |
+
yield "Starting email search..."
|
| 56 |
+
time.sleep(0.5)
|
| 57 |
+
yield "Scraping hompage and key pages..."
|
| 58 |
+
time.sleep(0.5)
|
| 59 |
+
yield "Quering search engines..."
|
| 60 |
+
time.sleep(0.5)
|
| 61 |
+
|
| 62 |
+
emails = get_combined_emails(domain)
|
| 63 |
+
if emails and isinstance(emails, list):
|
| 64 |
+
yield "Emails found:\n" + "\n".join(emails)
|
| 65 |
+
else:
|
| 66 |
+
yield "No valid emails found."
|
| 67 |
+
|
| 68 |
if __name__ == "__main__":
|
| 69 |
emails = get_combined_emails("gunvorgroup.com")
|
| 70 |
print("Found emails:")
|