Skip to content

fix: update NCAAB boxscore CSS selectors broken by sports-reference HTML changes#817

Open
seang1121 wants to merge 1 commit intoroclark:masterfrom
seang1121:fix/ncaab-boxscore-html-selectors
Open

fix: update NCAAB boxscore CSS selectors broken by sports-reference HTML changes#817
seang1121 wants to merge 1 commit intoroclark:masterfrom
seang1121:fix/ncaab-boxscore-html-selectors

Conversation

@seang1121
Copy link

Summary

sports-reference.com updated their page HTML structure, breaking several NCAAB boxscore fields that silently returned None or empty results.

Fields fixed:

  • away_name / home_namea[itemprop="name"] no longer exists on boxscore pages. Replaced with div#sb_team_0 strong a / div#sb_team_1 strong a which reflects the current scorebox_team div structure.
  • away_record / home_recorddiv[class="section_heading"] h2 no longer contains text. Replaced with div#boxes h2 (existing empty-string filter in _parse_record handles blank entries correctly).
  • away_ranking / home_ranking — Changed from fragile exact class attribute match (div[class="game_summary nohover current"]) to CSS class selector (div.game_summary.nohover.current) for robustness against attribute ordering.

Fixes

Verified against

Live 2024 NCAA Tournament game: Wagner (62) vs North Carolina (90), March 21 2024.
All name, record, score, and ranking fields return correct values after this change.

🤖 Generated with Claude Code

…TML changes

sports-reference.com updated their page structure, breaking multiple
NCAAB boxscore fields that returned None or empty results.

Changes to BOXSCORE_SCHEME in sportsipy/ncaab/constants.py:
- away_name/home_name: replaced deprecated a[itemprop="name"] with
  div#sb_team_0/1 strong a (sports-reference dropped itemprop attributes)
- away_record/home_record: replaced div#boxes div[class="section_heading"] h2
  with div#boxes h2 (section_heading wrapper no longer contains h2 elements)
- away_ranking/home_ranking: replaced exact class attribute match with
  CSS class selector (div.game_summary.nohover.current tr) for robustness

Verified against live 2024 NCAA Tournament game (Wagner vs North Carolina,
March 21 2024) — all fields now return correct values.

Fixes roclark#774 - NCAAB Boxscore returning blank for valid inputs
Fixes roclark#757 - winning_abbr, winning_name, losing_abbr, losing_name not populating

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NCAAB Boxscore and Boxscores returning blank for valid inputs NCAAB Boxscore losing_abbr, losing_name, winning_abbr, winning_name not populating

1 participant