Open LeoTRESPEUCH opened 5 years ago
Hello Susanli.
I am getting the same error message. I have already checked that bs4 module is installed in my system.
Are we missing something here?
Thank you very much!
replace line 65 with
num_reviews = soup.find('span', class_='hotels-hotel-review-community-content-TabBar__tabCount--37DbH').text # get text
note the class is changed to something else. I believe when she wrote it TA changed their website.
It was throwing a non type because you created a variable with Nothing inside then you tried using this nothing variable.
LOL, this is a moving target. Try replacing the suspect line as follows:
# num_reviews = soup.find('span', class_='reviews_header_count').text # get text
numSpan = soup.select('span[class*="hotels-hotel-review-community-content-TabBar__tabCount--"]')
num_reviews = numSpan[0].text # get text
I had the same issue and I solved it by inspecting my target page's code. Probably the errors you get are requiring you to review the source code, which has changed.
LOL, this is a moving target. Try replacing the suspect line as follows:
# num_reviews = soup.find('span', class_='reviews_header_count').text # get text numSpan = soup.select('span[class*="hotels-hotel-review-community-content-TabBar__tabCount--"]') num_reviews = numSpan[0].text # get text
Last line is giving error again. List index out of range
I am getting this error while running the code on jupytor notebook.
TypeError Traceback (most recent call last)
Hello Susanli, I tried to use your code but I received this error:
I'm university business professor but newbie with Python, could you help me to use your solution for scrap trip advisor hotel reviews ? Thanks in advance