Skip to content

Instantly share code, notes, and snippets.

@emarte91
Created August 29, 2018 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emarte91/de17b906ad50a31c12958b2c3a7bb04b to your computer and use it in GitHub Desktop.
Save emarte91/de17b906ad50a31c12958b2c3a7bb04b to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
url = "http://yourwebsitehere.com/"
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
email = soup.select('a[href^=mailto]')
with open("website_emails.csv", "a") as csv_file:
csv_writer = writer(csv_file)
for emails in email:
print(emails)
csv_writer.writerow([emails])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment