I am kind off a newbie within the python field and try to set up a webscraping tool. So I am experimenting some codes.
import requests
import bs4
website = requests.get("https://www.hltv.org/stats/teams")
soup = bs4.BeautifulSoup(website.text, "html.parser")
leaderboard = soup.find("table", {id: "stats-table player-ratings-table"})
tbody = leaderboard.find("tbody")
for tr in tbody.find.all('tr'):
team = tr.find.all('td')[0].text.strip()
maps = tr.find.all('td')[1].text.strip()
kd = tr.find.all('td')[3].text.strip()
rating = tr.find.all('td')[4].text.strip()
print(team, maps, kd, rating)
I get the following error, any help? I use 2.7.
File "/Users/*****/Python/New Webscraping/WebS.py", line 11, in <module>
tbody = leaderboard.find("tbody")
AttributeError: 'NoneType' object has no attribute 'find'
Process finished with exit code 1