-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemailScrape.py
More file actions
53 lines (26 loc) · 896 Bytes
/
emailScrape.py
File metadata and controls
53 lines (26 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import argparse
import requests
from bs4 import BeautifulSoup
import re
import pyfiglet
if __name__ =='__main__':
title = "Email Scraper"
ASCII_art = pyfiglet.figlet_format(title)
print(ASCII_art)
p = argparse.ArgumentParser()
p.add_argument('-website', type=str, required=True)
arg = p.parse_args()
m = r"\w+\@\w+\.\w+"
URL = arg.website.upper()
page = requests.get(URL)
def remove(html):
soup = BeautifulSoup(html, "html.parser")
for data in soup(['style', 'script']):
data.decompose()
return ''.join(soup.stripped_strings)
it = re.findall(m, remove(page.content))
if it:
print("Links and Emails found: \n\n" + ','.join(it), '\n')
print("Follow @LonerCode on GitHub :)")
else:
print("Not found")