Skip to content

Instantly share code, notes, and snippets.

@antoniotrento
Created March 25, 2017 18:10
Show Gist options
  • Save antoniotrento/dde58c053a057651cba9d5d50117f6e2 to your computer and use it in GitHub Desktop.
Save antoniotrento/dde58c053a057651cba9d5d50117f6e2 to your computer and use it in GitHub Desktop.
Web Scraping for Email Addresses and Phone numbers using Python
# Small Python Script to scrape websites for
# email addresses and phone numbers(not a very great RE)
# Author: Dhruv Baldawa (@dhruvbaldawa on twitter)
# Github: http://www.github.com/dhruvbaldawa
import urllib,re
f = urllib.urlopen("http://www.example.com")
s = f.read()
re.findall(r"\+\d{2}\s?0?\d{10}",s)
re.findall(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}",s)
# Output
# ['+02 2323123789', '+01 2334325323', '+00 2323123323']
# ['user@example.com']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment