web scraping infogol.net attributerror with beautiful soup

69 views Asked by At

I am trying to scrape the information for ajax matches from infogol. When I inspect the webpage I find that the table class = 'teamstats-summary-matches ng-scope' but whenI try this i find nothing. So far I have come up with the following code:

import requests
from bs4 import BeautifulSoup

# Set the URL of the webpage you want to scrape
url = 'https://www.infogol.net/en/team/ajax/62'

# Make a request to the webpage
response = requests.get(url)

# Parse the HTML of the webpage
soup = BeautifulSoup(response.text, 'html.parser')

# Find the table containing the data
table = soup.find('table', class_='teamstats-summary-matches ng-scope')

if not table:
    print('Cannot find table')
1

There are 1 answers

0
Diego Torres Milano On

Check that you have found what you are expecting before proceeding

# Find the table containing the data
table = soup.find('table', class_='stats-table')

if not table:
    print('Cannot find table')
    sys.exit(1)