Skip to content

Commit cb2839a

Browse files
authored
Update integration tests player advanced season totals and fix last row bug (#296)
1 parent 8caa4e8 commit cb2839a

File tree

19 files changed

+100738
-99
lines changed

19 files changed

+100738
-99
lines changed

basketball_reference_web_scraper/html.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,15 @@ def __init__(self, html):
248248

249249
@property
250250
def rows_query(self):
251+
# Basketball Reference includes individual rows for players that played for multiple teams in a season.
252+
# It also includes a "League Average" row that has a class value of 'norank'.
251253
return """
252254
//table[@id="advanced"]
253255
/tbody
254256
/tr[
255257
(
256-
not(contains(@class, 'thead'))
257-
or not(contains(@class, "rowSum"))
258+
not(contains(@class, 'thead')) and
259+
not(contains(@class, 'norank'))
258260
)
259261
]
260262
"""
@@ -361,7 +363,7 @@ def team_abbreviation(self):
361363

362364
@property
363365
def games_played(self):
364-
cells = self.html.xpath('td[@data-stat="g"]')
366+
cells = self.html.xpath('td[@data-stat="games"]')
365367

366368
if len(cells) > 0:
367369
return cells[0].text_content()

tests/integration/client/output/expected/player_advanced_season_totals/2001.csv

+491
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)