how to scraped cloaked email from webpage

182 Views Asked by At

I am trying to extract contacts information from this website but by looking into "inspect page", I found that all email addresses are cloaked and while trying to scrape these using Python 3.8 script with requests and BeautifulSoup libraries, an error appears saying:

This email address is being protected from spambots. You need JavaScript enabled to view it.

I tried to install selenium webdriver with Python but it gave errors during installation.

My questions are:

  • How can I extract emails that are protected like this?
  • Does it require "json" to do so?
  • How to install selenium webdriver in Python 3.8 on Windows 10 x64?

Here is the code tried so far:

import requests
from bs4 import BeautifulSoup
import re
url = "https://www.apdt.com.au/trainers-directory/trainers-directory.html"
r = requests.get(url)
soup = BeautifulSoup(r.content,"html.parser")
g_data = soup.findAll("div",{"class":"spEntryContainer"})[0].findAll("div",{"class":"col-sm-6"})
website = g_data[2].findAll("div",{"class":"spClassViewUrl"})
weblink = website[0].find('a').get('href')
r2 = requests.get(weblink)
domain = weblink.split("://")[1]
soup2 = BeautifulSoup(r2.text,"lxml")
print(soup2.prettify())
links = soup2.find_all("a",href=re.compile('.*@'+domain.replace("/","")))
print(links)`
0

There are 0 best solutions below