This package is designed to allow people to scrape Play by Play and Shift data off of the National Hockey League (NHL) API and website for all preseason, regular season and playoff games since the 2007-2008 season
Project description
Hockey-Scraper
Purpose
This package is designed to allow people to scrape the Play by Play and Shift data off of the National Hockey League (NHL) API and website for all preseason, regular season, and playoff games since the 2007-2008 season.
Prerequisites
You are going to need to have python installed for this. This should work for both python 2.7 and 3 (I recommend having from at least version 3.6.0 but earlier versions should be fine).
If you don’t have python installed on your machine, I’d recommend installing it through the anaconda distribution. Anaconda comes with a bunch of libraries pre-installed so it’s easier to start off.
Installation
To install all you need to do is open up your terminal and type in:
pip install hockey_scraper
Usage
Scrape data on a season by season level:
import hockey_scraper # Scrapes the 2015 & 2016 season with shifts and stores the data in a Csv file hockey_scraper.scrape_seasons([2015, 2016], True) # Scrapes the 2008 season without shifts and returns a json string of the data scraped_data = hockey_scraper.scrape_seasons([2008], False, data_format='Json')
Scrape a list of games:
import hockey_scraper # Scrapes the first game of 2014, 2015, and 2016 seasons with shifts and stores the data in a Csv file hockey_scraper.scrape_games([2014020001, 2015020001, 2016020001], True) # Scrapes the first game of 2007, 2008, and 2009 seasons with shifts and returns a Json string of the data scraped_data = hockey_scraper.scrape_games([2007020001, 2008020001, 2009020001], True, data_format='Json')
Scrape all games in a given date range:
import hockey_scraper # Scrapes all games between 2016-10-10 and 2016-10-20 without shifts and stores the data in a Csv file hockey_scraper.scrape_date_range('2016-10-10', '2016-10-20', False) # Scrapes all games between 2015-1-1 and 2015-1-15 without shifts and returns a Json string of the data scraped_data = hockey_scraper.scrape_date_range('2015-1-1', '2015-1-15', False, data_format='Json')
The full documentation can be found here.
Contact
Please contact me for any issues or suggestions. For any bugs or anything related to the code please open an issue. Otherwise you can email me at Harryshomer@gmail.com.
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_scraper-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b2e8538a99324f1b86161b9c98eb6d75f430009ab74daa1e38a2f3fc8bc2803 |
|
MD5 | 7a4e8a2928068108b4ab3a16c4248c41 |
|
BLAKE2b-256 | 63482093e9a197de98bd77a505dca766cd2f4c0234eaea74e1da0e6095a6c930 |