-
-
Notifications
You must be signed in to change notification settings - Fork 669
Expand file tree
/
Copy pathgetweblinks.py
More file actions
24 lines (22 loc) · 755 Bytes
/
getweblinks.py
File metadata and controls
24 lines (22 loc) · 755 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
import bs4
"""Get all onion links from the website"""
def getLinks(soup):
_soup_instance = bs4.BeautifulSoup
if isinstance(type(soup), type(_soup_instance)):
websites = []
for link in soup.find_all('a'):
email_link = link.get('href')
if email_link != None:
if 'http' in email_link:
websites.append(email_link)
else:
pass
"""Pretty print output as below"""
print ('')
print ('Websites Found - '+str(len(websites)))
print ('-------------------------------')
for web in websites:
print (web)
return ''
else:
raise('Method parameter is not of instance bs4.BeautifulSoup')