davidjkrause / sportsipy

A free sports API written for python
MIT License
33 stars 8 forks source link

Boxscore returning None #10

Open windowshopr opened 1 week ago

windowshopr commented 1 week ago
from sportsipy.ncaaf.boxscore import Boxscore

# Get a Pandas DataFrame of all stats for a MLB game
game = Boxscore('CHA202406090')
df = game.dataframe
print(df)

Output:

None

URL testing: https://www.baseball-reference.com/boxes/CHA/CHA202406090.shtml

davidjkrause commented 6 days ago

Confirmed this fails with an error running the following code. Note the CHA/ at the start of the boxscore link, which I found in the code comments as well.

Without the leading CHA/, the package fails to find any boxscore and just returns silently. With the leading CHA/, there is an unrecoverable error in parsing the boxscore HTML.

from sportsipy.mlb.boxscore import Boxscore

# Get a Pandas DataFrame of all stats for a MLB game
game = Boxscore('CHA/CHA202406090')
df = game.dataframe
print(df)

Seems like at least the header section the package uses to get the team info changed from a table to a collection of divs, so the code will need to be re-worked, probably pretty extensively.