Skip to content

Add countries and national teams crawlers#99

Merged
dcaribou merged 7 commits into
mainfrom
add-countries-national-teams
Mar 21, 2026
Merged

Add countries and national teams crawlers#99
dcaribou merged 7 commits into
mainfrom
add-countries-national-teams

Conversation

@dcaribou

@dcaribou dcaribou commented Mar 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add countries crawler — discovers all countries from confederation pages, outputting country items with metadata (country_id, country_name, code, total_clubs, total_players, market values)
  • Add national_teams crawler — takes country parents and scrapes the senior national team per country (squad size, market value, coach, ranking)
  • Extend players crawler to accept national_team parents (national team squad pages use the same URL pattern as clubs)
  • Add competitions support for national team competitions (World Cup, Euros, etc.) — these are now emitted alongside domestic competitions from the confederation page
  • Fix games crawler crash on None footer link and add fallback gesamtspielplan link discovery for tournament competitions (UEFA Euro, World Cup)
  • Add tournament_editions crawler — takes any cup competition and scrapes all historical editions from the /erfolge/ page (year, season id, winner, coach)
  • Document Transfermarkt's season convention: summer tournaments use saison_id = tournament_year - 1 (e.g. Qatar 2022 → --season 2021, Euro 2024 → --season 2023)

New pipeline branches:

# National teams (new)
Confederations ====> Countries ====> National Teams ====> Players ====> Appearances

# Tournament history (new)
Competitions ====> Tournament Editions ====> Games

Test plan

  • test_confederations — 5 confederations including FIFA
  • test_competitions — domestic + national team competitions from Afrika confederation
  • test_competitions_fifa — World Cup and qualifier competitions from FIFA confederation
  • test_clubs — clubs from Croatian 1.HNL
  • test_players — players from HNK Sibenik
  • test_appearances — appearances for Ayoze Perez
  • test_games — DFL Supercup (domestic super cup, 1 game)
  • test_games_euro — UEFA Euro 2024 (season=2023), asserts ≥ 48 games
  • test_games_world_cup — FIFA World Cup Qatar 2022 (season=2021), asserts ≥ 60 games
  • test_game_lineups — DFL Supercup 2024 lineups
  • test_countries — countries from Afrika confederation
  • test_national_teams — Wales national team
  • test_national_team_players — players from Wales national team squad
  • test_tournament_editions — all historical World Cup editions (≥ 20), verifies 2022 edition has season="2021" and winner="Argentina"

🤖 Generated with Claude Code

dcaribou and others added 3 commits March 9, 2026 21:50
Introduce a new parallel pipeline branch from confederations:
confederations → countries → national_teams → players → appearances

The countries crawler discovers countries from confederation pages (deduped
by country_id). The national_teams crawler visits country pages, finds the
senior national team, and scrapes team details (squad size, market value,
FIFA ranking, confederation, coach, etc.). The players crawler now also
accepts national_team parents via a fallback table selector.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rally

- Add /wettbewerbe/fifa as a 5th confederation so World Cup and global
  qualifiers are discovered alongside confederation-level competitions
- Extract national team competitions (Euro, Nations League, AFCON, Copa
  América, WC qualifiers, etc.) from the headerless div.box blocks on
  each confederation page; deduplicated by href, emitted on page 1 only
- Skip country-page visits for the FIFA rankings page (not a league listing)
- Add defensive guards on country row iteration in competitions.py
- Remove per-team competition extraction from national_teams.py (was
  causing the same competition to appear once per participating team)
- Add samples/national_team_competitions.json with 130 competitions
- Update README with dual-hierarchy diagram, crawler table, and usage
  examples for national team workflows
- Update tests: confederations count 4→5, competitions asserts national
  team items present, new test_competitions_fifa

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The parse handler previously crashed on None footer link text and had no
fallback for competitions (like UEFA Euro) whose pages don't use the
standard "All fixtures & results" footer link. Add a gesamtspielplan
href fallback and a test confirming Euro 2024 scrapes correctly via
season=2023 (Transfermarkt's convention for that tournament).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dcaribou and others added 4 commits March 20, 2026 22:06
Scrapes the /erfolge/ page to get all historical editions of a tournament
competition, emitting year, season (saison_id), winner, winner image, and
victory coach per edition. The season field maps directly to the --season
argument needed by the games crawler (e.g. season=2021 for Qatar 2022).

Also adds test_tournament_editions (World Cup) and test_games_world_cup
(Qatar 2022, season=2021), and bumps crawlee to ^1.6.0 to pick up
the parsel extra.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dcaribou
dcaribou merged commit b3970b0 into main Mar 21, 2026
1 of 2 checks passed
@dcaribou
dcaribou deleted the add-countries-national-teams branch March 21, 2026 10:17
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.

1 participant