Skip to content
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
10 changes: 7 additions & 3 deletions basketball_reference_web_scraper/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,10 @@ def team_names_query(self):
return \
'//*[@id="content"]' \
'//div[@class="scorebox"]' \
'//div[@itemprop="performer"]' \
'//a[@itemprop="name"]'
'//strong' \
'//a'
# '//div[@itemprop="performer"]' \
# '//a[@itemprop="name"]'

@property
def play_by_play_table(self):
Expand Down Expand Up @@ -850,9 +852,11 @@ def has_play_by_play_data(self):
# Need to avoid rows that indicate start of period
# Or denote tipoff / end of period (colspan = 5)
# Or are one of the table headers for each period group (aria-label = Time)
# And remove events that happen during dead time at start / end of period (e.g. substitutions)
return not self.is_start_of_period \
and self.html[1].get('colspan') != '5' \
and self.timestamp_cell.get('aria-label') != 'Time'
and not self.timestamp_cell.get('aria-label') in ['Time', ''] \
and not self.timestamp.endswith('00.0')


class DailyBoxScoresPage:
Expand Down
2 changes: 1 addition & 1 deletion basketball_reference_web_scraper/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def parse(self, play_by_plays, away_team, home_team):
result = []
for play_by_play in play_by_plays:
if play_by_play.is_start_of_period:
current_period += 1
current_period = int(play_by_play.html.get('id').strip('q'))
elif play_by_play.has_play_by_play_data:
result.append(self.format_data(
current_period=current_period,
Expand Down