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

Update NBA stats table CSS selector #764

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sportsipy/mlb/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,9 @@
'duration': 'game duration'
}

STANDINGS_URL = ('https://www.baseball-reference.com/leagues/MLB/'
STANDINGS_URL = ('https://www.baseball-reference.com/leagues/majors/'
'%s-standings.shtml')
TEAM_STATS_URL = 'https://www.baseball-reference.com/leagues/MLB/%s.shtml'
TEAM_STATS_URL = 'https://www.baseball-reference.com/leagues/majors/%s.shtml'

SCHEDULE_URL = ('https://www.baseball-reference.com/teams/%s/'
'%s-schedule-scores.shtml')
Expand All @@ -525,4 +525,4 @@
ROSTER_URL = 'https://www.baseball-reference.com/teams/%s/%s.shtml'

NIGHT = 'Night'
DAY = 'Day'
DAY = 'Day'
4 changes: 2 additions & 2 deletions sportsipy/nba/nba_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def _retrieve_all_teams(year, season_file=None):
utils._url_exists(SEASON_PAGE_URL % str(int(year) - 1)):
year = str(int(year) - 1)
doc = utils._pull_page(SEASON_PAGE_URL % year, season_file)
teams_list = utils._get_stats_table(doc, 'div#div_totals-team')
opp_teams_list = utils._get_stats_table(doc, 'div#div_totals-opponent')
teams_list = utils._get_stats_table(doc, '#totals-team')
opp_teams_list = utils._get_stats_table(doc, '#totals-opponent')

if not teams_list and not opp_teams_list:
utils._no_data_found()
Expand Down
10 changes: 5 additions & 5 deletions sportsipy/nfl/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
BOXSCORE_SCHEME = {
'game_info': 'div[class="scorebox_meta"]:first',
'game_details': 'table#game_info tr',
'home_name': 'a[itemprop="name"]:first',
'home_name': 'div[class="linescore_wrap"] table tbody tr:last td:nth-child(2)',
'summary': 'table[class="linescore nohover stats_table no_freeze"]:first',
'team_stats': 'table#team_stats thead',
'away_name': 'a[itemprop="name"]:last',
'away_name': 'div[class="linescore_wrap"] table tbody tr:first td:nth-child(2)',
'away_points': 'div[class="scorebox"] div[class="score"]',
'away_first_downs': 'td[data-stat="vis_stat"]',
'away_rush_attempts': 'td[data-stat="vis_stat"]',
Expand Down Expand Up @@ -138,7 +138,7 @@
'stadium': 2,
'attendance': 3,
'duration': 4,
'away_points': 1,
'away_points': 0,
'away_first_downs': 0,
'away_rush_attempts': 1,
'away_rush_yards': 1,
Expand All @@ -162,7 +162,7 @@
'away_fourth_down_conversions': 10,
'away_fourth_down_attempts': 10,
'away_time_of_possession': 11,
'home_points': 0,
'home_points': 1,
'home_first_downs': 0,
'home_rush_attempts': 1,
'home_rush_yards': 1,
Expand Down Expand Up @@ -339,7 +339,7 @@
'fumbles_forced': 'td[data-stat="fumbles_forced"]',
'fumbles_recovered': 'td[data-stat="fumbles_rec"]',
'yards_recovered_from_fumble': 'td[data-stat="fumbles_rec_yds"]',
'fumbles_recovered_for_touchdown': 'td[data-stat="fumbles_rec_td"]',
'fumbles_recovered_for_touchdown': 'td[data-stat="fumbles_rec_yds"]',
'sacks': 'td[data-stat="sacks"]',
'tackles': 'td[data-stat="tackles_solo"]',
'assists_on_tackles': 'td[data-stat="tackles_assists"]',
Expand Down