Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 75e3b7f

Browse files
Merge pull request avinashkranjan#525 from ankurg132/master
Script to extract emails from a website content
2 parents bcdcd78 + 4405d01 commit 75e3b7f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import re
2+
import requests
3+
4+
url = input("Enter Url: ")
5+
text = requests.get(url).text
6+
7+
x = re.findall(r"[a-zA-Z]+@{1}[a-zA-Z]+[.]{1}[a-zA-Z]+", text) #Regex query which search for the particular email format.
8+
9+
val=""
10+
for i in x:
11+
val+=i+"\n" #this adds all the email data found in val variable
12+
13+
if val=="":
14+
print("No emails found in the website")
15+
else:
16+
filename= input("Enter the file Name you want (without extension):")
17+
with open(f"{filename}.txt","w") as file:
18+
file.write(val)
19+
print("Your File has been Saved")
20+
print("Email(s) found:\n")
21+
print(val)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Setup
2+
- To use this script, simply clone this repo, go to the project directory in command line and type "python extracting-emails-from-website".
3+
- Also, additionally you may need to use "pip install requests" in your command line before executing the python file.
4+
5+
## Author
6+
- Ankur Gupta [Github profile](https://github.com/ankurg132)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /