I was web scraping a Wikipedia table using Beautiful Soup this is my code
Code
URL="https://en.wikipedia.org/wiki/List_of_most-viewed_YouTube_videos"
page=requests.get(URL)
soup1=BeautifulSoup(page.text,'lxml')
table = soup1.find('table',{'class':'wikitable sortable jquery-tablesorter'})
headers=[]
for i in table.find_all('tr'):
title=i.text.strip()
headers.append(title)
I got Error as
AttributeError: 'NoneType' object has no attribute 'find_all'
I tried using htmlparser and get_text function also still getting same error even same error for th also.