I have been trying to extract the name from a twitter profile, the only problem I'm having is that beautifulsoup grabs the entire element. I have tried the {"class":}
to specify the element but whenever I do this it results in getting
AttributeError: 'NoneType' object has no attribute 'text' error.
My code:
url = "https://twitter.com/barackobama"
html_doc = urllib.request.urlopen(url)
soup = BeautifulSoup(html_doc, 'lxml')
name = soup.find('h1').text
print(name)