I can’t seem to get the program extract the text from td class=”number pp_2 bk_pp nowrap” from the webpage “https://www.racingandsports.com.au/form-guide/thoroughbred/australia/mornington/2024-04-29/R1/enhanced-form”. What do I need to change TFO tab text? Note: when the webpage loads there’s a minor delay before the numbers appear on the TFO tab.
import requests
from bs4 import BeautifulSoup
import time
# URL of the webpage
url = "https://www.racingandsports.com.au/form-guide/thoroughbred/australia/mornington/2024-04-29/R1/enhanced-form"
# Fetch the webpage content
response = requests.get(url)
# Introduce a 8-second delay
time.sleep(8)
html_content = response.content
# Parse the HTML content
soup = BeautifulSoup(html_content, "html.parser")
# Find all td elements with class="number pp_2 bk_pp nowrap"
td_elements = soup.find_all("td", class_="number pp_2 bk_pp nowrap")
# Extract text from td elements and print
for td in td_elements:
print(td.text.strip())