Scraper for ice hockey data
Project description
Hockey-API
Purpose
The purpose of this package is to scrape data from ice hockey leagues, currently the NHL, from available APIs and websites. The information that is scraped is both play by play and shift data, with support for all parts of the seasons (preseason, regular season, all star and playoffs) for seasons starting from 2010-2011.
Getting started
A short introduction to the prerequisites and installation.
Prerequisites
This package is built on Python, particularly Python3. To use this package, the Python version should be at least 3.7.0.
Installation
To install, simply open a terminal and run either of the following commands:
pip install hockey_api
python -m pip install hockey_api
Usage
To scrape data, three different functions are provided. Each function provides the same output structure, with a tuple containing play by play data for all the game(s) as well as the shifts.
- To scrape a list of games, where the input should be a list of game ids:
from hockey_api import scrape_list_of_games
# Scrape the first three games of the 2021-2022 NHL season.
pbp, shifts = scrape_list_of_games(game_id_list=[2021020001, 2021020002, 2021020003])
- To scrape a list of games between two dates:
from hockey_api import scrape_date_range
# Scrape the all the games during the month of October in 2021.
pbp, shifts = scrape_date_range(start_date="2021-10-01", end_date="2021-10-31")
# Scrape games from a given date.
pbp, shifts = scrape_date_range(start_date="2021-10-31")
- To scrape a specific part of a season:
from hockey_api import scrape_season
# Scrape all games from the 2021-2022 NHL regular season.
pbp, shifts = scrape_season(season=2021, season_type="R")
# Scrape all games from the 2021-2022 NHL playoffs.
pbp_playoffs, shifts_playoffs = scrape_season(season=2021, season_type="P")
Saving data
Miscellaneous
Contact
Copyright
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for hockey_api-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf70008e2b05783712c773b51838a6334decf3df3712e09cfdcac507fc860a3a |
|
MD5 | b4caca7ebd2abf4a56c9312d3a004816 |
|
BLAKE2b-256 | 8f62f2206f187f7a97307d1f0ec95bd614dffe54c29dad50ceb913b61dfda957 |