This question is similar to this one. I have read the answers, but none worked for me. I am trying to get the informations from the bluish box in this site.
This is what I wrote:
import requests
from bs4 import BeautifulSoup
import re
url = 'https://boardgamegeek.com/boardgame/161936/pandemic-legacy-season-1'
req = requests.get(url)
soup = BeautifulSoup(req.text,'html5lib')
soup = soup.find('div', class_='game-header-body')
print(soup.prettify())
I get this error AttributeError: 'NoneType' object has no attribute 'prettify'
. The reason is because it cannot find the 'game-header-body', therefore becomes NoneType
. When I remove the soup = soup.find('div', class_='game-header-body')
line, I can see all the html code except the div I am interested in.
I have read that maybe it is better to change to the 'html5lib' parser library. I installed it through pip3 install html5lib
(I am using python 3.4.3), but still I get the aforementioned error. What should I do?