jaebradley/basketball_reference_web_scraper

play by play API appears to be broken

Closed this issue · 0 comments

krlu commented

when I run the following query

from basketball_reference_web_scraper import client
from basketball_reference_web_scraper.data import OutputType, Team

client.play_by_play(
    home_team=Team.BOSTON_CELTICS, 
    year=2018, month=10, day=16, 
    output_type=OutputType.JSON, 
    output_file_path="./2018_10_06_BOS_PBP.json"
)

I get the following error:

Traceback (most recent call last):
  File "C:/Users/Owner/Desktop/dev/nbastats/get_stats.py", line 35, in <module>
    output_file_path="./2018_ATL_PBP.json"
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site-packages\basketball_reference_web_scraper\client.py", line 220, in play_by_play
    values = http_service.play_by_play(home_team=home_team, day=day, month=month, year=year)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site-packages\basketball_reference_web_scraper\http_service.py", line 106, in play_by_play
    away_team_name=page.away_team_name,
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python37\lib\site-packages\basketball_reference_web_scraper\html.py", line 791, in away_team_name
    return self.team_names[0]
IndexError: list index out of range

Notably, when I delve into the API, it would appear that in html.py for basketball_reference_web_scraper the team_names_query function does not seem to be returning any team names, and as a result the team_names function simply returns an empty array