BeautifulSoup find.text returns empty string although element exists

I am scraping the following; https://www.espn.com/nfl/scoreboard/ and trying to get the times of the games

import requests
from bs4 import BeautifulSoup

r = requests.get("https://www.espn.com/nfl/scoreboard")
soup = BeautifulSoup(r.content, "lxml")

for section in soup.find_all("section", {"class": "Card gameModules"}):
    for game in section.find_all("section", {"class": "Scoreboard bg-clr-white flex flex-auto justify-between"}):
        print(game.find("div", {"class": "ScoreCell__Time ScoreboardScoreCell__Time h9 clr-gray-03"}).text)

Even though it should return the times of the games, it just returns empty strings. Why is this?



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Object oriented programming concepts (OOPs)

Spring Boot and Vaadin : Filtering rows in Vaadin Grid