A complete football analytics pipeline that scrapes World Cup data from multiple public sources, normalizes it into reusable datasets, and generates publication-ready visualizations.
- Scrapes official FIFA tournament statistics
- Scrapes advanced player statistics from SofaScore
- Extracts tournament metadata from Wikipedia
- Normalizes data into reusable JSON datasets
- Exports normalized CSV files for further analysis
- Generates interactive Plotly visualizations
- Generates publication-ready Matplotlib charts
- Organizes outputs into a reproducible analytics pipeline
- Python
- Zenrows API key
git clone https://github.com/ZenRows/scraping-world-cup-data.git
cd scraping-world-cup-datapython -m venv .venvmacOS / Linux:
source .venv/bin/activateWindows:
.venv\Scripts\activatepip install -r requirements.txtThis project uses Zenrows Fetch and Browser Sessions to access data from multiple protected web sources.
Create a .env file in the project root.
ZENROWS_API_KEY=your_api_key
Replace your_api_key with your Zenrows API key.
.
├── charts/
│ ├── fifa/
│ ├── sofascore/
│ └── wikipedia/
│
├── data/
│ ├── raw/
│ │ ├── fifa/
│ │ ├── sofascore/
│ │ └── wikipedia/
│ │
│ └── normalized/
│ ├── fifa/
│ ├── sofascore/
│ └── wikipedia/
│
├── data_sources/
├── normalizers/
├── visualizers/
│ ├── fifa/
│ ├── sofascore/
│ └── wikipedia/
│
├── main.py
├── requirements.txt
└── README.md
The pipeline collects World Cup data from FIFA, SofaScore, and Wikipedia before normalizing the datasets and generating visualizations.
FIFA
│
SofaScore
│
Wikipedia
│
▼
Data collection
│
▼
Data normalization
│
▼
Visualization pipeline
│
▼
PNG • HTML • CSV outputs
The pipeline performs three stages:
- Scrape raw data
- Normalize the datasets
- Generate visualizations
Execute the complete pipeline:
python main.pyRunning the project generates three categories of output.
data/raw/
Contains the original HTML and JSON responses collected from the sources.
data/normalized/
Contains cleaned datasets ready for analysis.
Example:
data/normalized/fifa/
attacking.json
defending.json
discipline.json
distribution.json
goalkeeping.json
movement.json
physical.json
Generated visualizations are saved to:
charts/
Each visualization is exported as:
- PNG
- Interactive HTML
- CSV (where applicable)
- Possession vs Goal Attempts
- Passing Accuracy vs Defensive Line Break Attempts
- Goalkeeper Saves vs Goals Conceded
- Goalkeeper Save Percentage vs Expected Goals
- Defensive Pressure vs Ball Recovery Time
- Shot Location vs Conversion Rate
- Speed Runs vs Off-Ball Passing Options
- Runs in Behind vs Receptions in Behind
- xG vs Goals
- Big Chances Missed vs Conversion
- Passing Accuracy vs Key Passes
- Big Chances Created vs Assists
- Goalkeeper Metrics
- Player Rating Distribution
- Top Defenders
- Hosts vs Stadiums
- Python
- Playwright
- Zenrows Fetch
- Zenrows Browser Sessions
- BeautifulSoup
- Pandas
- NumPy
- Plotly
- Matplotlib
| Source | Data Collected |
|---|---|
| FIFA | Team attacking, defending, passing, physical, movement, discipline, and goalkeeping statistics |
| SofaScore | Player attacking, passing, defending, and goalkeeping statistics |
| Wikipedia | Tournament hosts, cities, and stadium information |
- The pipeline is modular. Each data source client, normalizer, and visualizer can be run independently.
- Charts are generated in both static and interactive formats.
- The normalized datasets are designed to be reusable for downstream analytics workflows.
This repository accompanies this blog: Scraping 2026 FIFA World Cup Data With Python and Zenrows