Skip to content

Commit

Permalink
Changes docs and made misc. changes to code
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryShomer committed Dec 25, 2017
1 parent 8379e5a commit b9497ce
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 28 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ This package is designed to allow people to scrape the Play by Play and Shift da
Prerequisites
-------------

You are going to need to have python installed for this. Specifically, you’ll need from at least version 3.6.0
(just to be safe, it will most likely be fine for earlier versions of 3).
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
<https://www.continuum.io/downloads>`_. Anaconda comes with a bunch of libraries pre-installed so it’s easier to start off.
Expand Down
Binary file modified docs/.DS_Store
Binary file not shown.
Binary file added docs/source/.DS_Store
Binary file not shown.
8 changes: 6 additions & 2 deletions docs/source/hockey_scraper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Play is automatically scraped.


# When scraping by game or date range
"
{
'pbp': [
Plays
Expand All @@ -81,8 +82,10 @@ Play is automatically scraped.
Shifts
]
}
"

# When scraping by season
"
{
'pbp': {
'Seasons': [
Expand All @@ -95,9 +98,10 @@ Play is automatically scraped.
]
}
}

"

# For example, if you scraped the 2008 and 2009 seasons the Json will look like this:
"
{
'pbp': {
'2008': [
Expand All @@ -116,7 +120,7 @@ Play is automatically scraped.
]
}
}

"


Functions
Expand Down
Binary file modified hockey_scraper/.DS_Store
Binary file not shown.
43 changes: 24 additions & 19 deletions hockey_scraper/game_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,25 +308,30 @@ def print_errors():
global espn_games
global missing_coords

print('\nBroken pbp:')
for x in broken_pbp_games:
print(x[0], x[1])

print('\nBroken shifts:')
for x in broken_shifts_games:
print(x[0], x[1])

print("\nPlayers missing ID's:")
for x in players_missing_ids:
print(x[0], x[1])

print('\nESPN games:')
for x in espn_games:
print(x[0], x[1])

print('\nGames missing coordinates:')
for x in missing_coords:
print(x[0], x[1])
if broken_pbp_games:
print('\nBroken pbp:')
for x in broken_pbp_games:
print(x[0], x[1])

if broken_shifts_games:
print('\nBroken shifts:')
for x in broken_shifts_games:
print(x[0], x[1])

if players_missing_ids:
print("\nPlayers missing ID's:")
for x in players_missing_ids:
print(x[0], x[1])

if espn_games:
print('\nESPN games:')
for x in espn_games:
print(x[0], x[1])

if missing_coords:
print('\nGames missing coordinates:')
for x in missing_coords:
print(x[0], x[1])

print('\n')

Expand Down
2 changes: 1 addition & 1 deletion hockey_scraper/scrape_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def scrape_seasons(seasons, if_scrape_shifts, data_format='csv', preseason=False
game_scraper.print_errors()

# If we have something in there that means json was chosen
if len(json_dfs.keys()) > 0:
if len(json_dfs['pbp'].keys()) > 0:
return json.dumps(json_dfs)


Expand Down
4 changes: 2 additions & 2 deletions hockey_scraper/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
'TIMOTHY JR. THOMAS': 'Tim Thomas', 'ILJA BRYZGALOV': 'Ilya Bryzgalov', 'MATHEW DUMBA': 'Matt Dumba',
'MICHAËL BOURNIVAL': 'Michael Bournival', 'MATTHEW BENNING': 'Matt Benning', 'ZACHARY SANFORD': 'Zach Sanford',
'AJ GREER': 'A.J. Greer', 'JT COMPHER': 'J.T. Compher', 'NICOLAS PETAN': 'Nic Petan',
'VINCENT HINOSTROZA': 'Vinnie Hinostroza', 'PHILIP VARONE': 'Phil Varone', 'JOSHUA MORRISSEY': 'Josh Morrissey',
'VINCENT HINOSTROZA': 'Vinnie Hinostroza', 'PHILIP VARONE': 'Phil Varone', 'JOSHUA MORRISSEY': 'Josh Morrissey',
'Mathew Bodie': 'Mat Bodie', 'MICHAEL FERLAND': 'Micheal Ferland', 'MICHAEL SANTORELLI' :'Mike Santorelli',
'CHRISTOPHER BREEN': 'Chris Breen', 'BRYCE VAN BRABRANT': 'Bryce Van Brabant', 'ALEXANDER KILLORN': 'Alex Killorn',
'JOSEPH MORROW': 'Joe Morrow', 'ALEX STEEN': 'Alexander Steen', 'BRADLEY MILLS': 'Brad Mills',
Expand All @@ -111,7 +111,7 @@
'OLAF KOLZIG': 'OLIE KOLZIG', 'J-SEBASTIEN AUBIN': 'JEAN-SEBASTIEN AUBIN', 'ALEXANDER AULD': 'ALEX AULD',
'JAMES HOWARD': 'JIMMY HOWARD', 'JEFF DROUIN-DESLAURIERS': 'JEFF DESLAURIERS', 'SIMEON VARLAMOV': 'SEMYON VARLAMOV',
'ALEXANDER PECHURSKI': 'Alexander Pechurskiy', 'JEFFREY PENNER': 'JEFF PENNER', 'EMMANUEL FERNANDEZ': 'Manny FERNANDEZ',
'ALEXANDER PETROVIC': 'ALEX PETROVIC'
'ALEXANDER PETROVIC': 'ALEX PETROVIC',
}


Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def read():

setup(
name='hockey_scraper',
version='1.1',
version='1.2',
description="""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""",
Expand All @@ -16,7 +16,8 @@ def read():
"Development Status :: 5 - Production/Stable",
'Intended Audience :: Science/Research',
"License :: OSI Approved :: MIT License",
'Programming Language :: Python :: 3'
'Programming Language :: Python :: 3',
"Programming Language :: Python :: 2",
],
keywords='NHL',
url='https://github.com/HarryShomer/Hockey-Scraper',
Expand Down

0 comments on commit b9497ce

Please sign in to comment.