Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlayByPlay missing goal events #21

Open
jcnavin opened this issue Mar 20, 2021 · 1 comment
Open

PlayByPlay missing goal events #21

jcnavin opened this issue Mar 20, 2021 · 1 comment

Comments

@jcnavin
Copy link

jcnavin commented Mar 20, 2021

The following code:

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)

Produces the output:

b'STL #9 BLAIS(1), Tip-In, Off. Zone, 8 ft.' b"Assists: #57 PERRON(1); #90 O'REILLY(1)"
b'STL #27 PIETRANGELO(1), Slap, Off. Zone, 38 ft.' b"Assists: #72 FAULK(1); #90 O'REILLY(2)"
b'WSH #9 ORLOV(1), Slap, Off. Zone, 55 ft.' b'Assists: #3 JENSEN(1); #20 ELLER(2)'
b'WSH #13 VRANA(1), Wrist, Off. Zone, 29 ft.' b'Assists: #74 CARLSON(2); #77 OSHIE(1)'

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 using Python 3.7.3.

@jcnavin
Copy link
Author

jcnavin commented Mar 21, 2021

I've fixed this--it was a one liner. Sent you a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant