I have link which I need to extract
- Name, contact, Contact Us, Phone number extract from contact us using regex
Below code successfully extract name, Rest tag are in nested format? How to do that
import re
l = ['https://www.aaaindia.org/author/aapl/']
result = []
for link in l:
parser = 'html.parser'
resp = urllib.request.urlopen(link)
soup = BeautifulSoup(resp, parser, from_encoding=resp.info().get_param('charset'))
for individual in soup.find_all("div", {"class": "grey_container"}):
name = individual.find('h4').text
contact = individual.find("p").text
contactus = individual.find("p").text
phonenu = re.findall('/d+',contactus )
result.append({"name":name,'contact': contact, 'contactus':contactus, 'phone':phonenu})