(Aug-18-2017, 07:46 PM)stefanoste78 Wrote: I do not want to extract emails from a file. The excel file contains urls in a column and I was hoping that is possible to exctract all the emails in the site beside each cell.You read in Excel with eg Openpyxl, Pandas.
Cell with url address you give to Requests.
Then is web scraping i have a tutorial here.
Email links in html has a unique look that it begins with
mailto:
.Then can use a CSS selector like
a[href^="mailto"]
Example:
from bs4 import BeautifulSoup # Simulate a web page html = '''\ <html> <body> <p>Email me at <a class="emaillink" href="mailto:[email protected]">[email protected]</a></p> <p>Email<a id='foo' href="mailto:[email protected]">[email protected]</a></p> </body> </html>''' soup = BeautifulSoup(html, 'lxml') email = soup.select('a[href^="mailto"]') for link in email: print(link.text)
Output:[email protected]
[email protected]