from nhlscrapi.games.game import GameKey, Game, GameType
from nhlscrapi.games.playbyplay import PlayByPlay
from nhlscrapi.games.events import EventType
SEASON = 2020
GAME_TYPE = GameType.Regular
# STL vs WASH 10/2/2019
GAME_ID = 2
EVENT_TYPE = EventType.Goal
# get play by play
pbp = PlayByPlay(game_key=GameKey(SEASON, GAME_TYPE, GAME_ID))
# for every play in pbp, if it's a goal, print it
for play in pbp.plays:
if play.event.event_type == EVENT_TYPE:
print(play.event.desc)
Looking at the box score on either HockeyReference or the NHL website shows there is a missing goal by Alexander Ovechkin scored at the end of the first period. This bug is not idiosyncratic to this game either, I've tested it on the first game of the 2020-2021 season and certain goals are omitted there as well.
The following code:
Produces the output:
Looking at the box score on either HockeyReference or the NHL website shows there is a missing goal by Alexander Ovechkin scored at the end of the first period. This bug is not idiosyncratic to this game either, I've tested it on the first game of the 2020-2021 season and certain goals are omitted there as well.
I'm on
MacOS
usingPython 3.7.3
.