Skip to main content

Football Stats Scraper - Footstats CLI

Project description

Footstats CLI

Football player stats, transfers, and market values — straight from your terminal.

License: MIT UV Python


Overview

Footstats is an open-source CLI tool that lets you search for any football player and retrieve their profile, transfer history, and match statistics — all from your terminal, powered by data from Transfermarkt.


Features

  • Player Search — Search any player by name
  • Player Profile — Market value, age, club, position, nationality, and more
  • Transfer History — Full transfer history with fees and market values
  • Match Stats — Per-game stats including goals, assists, cards, minutes, passes, and shots
  • Interactive Menu — Navigate with a single keypress
  • Direct Commands — Call any command directly with arguments

Data Sources

Source Data
Transfermarkt Market value, transfers, match stats, player profile

Requirements


Installation

1. Install UV

# macOS
brew install uv

# Linux/macOS
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

2. Clone the repository

git clone https://github.com/Marin2409/footstats-cli.git
cd footstats-scraper

3. Install dependencies

uv sync

4. Set up environment variables

cp .env.example .env

5. Activate the Virtual Environment

# Get Python interpreter path for VSCode
uv run which python

Using VSCODE Command Pallete:

  1. Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)
  2. Type "Python: Select Interpreter"
  3. Paste the path from above
  4. Create a new terminal (Cmd+Shift+P -> "Create New Terminal with Profile")

In terminal Activate the new virtual environment so that any Python command you run or package you install uses it.

source .venv/bin/activate

Every time you install a new package in that environment, activate the environment again.

This makes sure that if you use a terminal (CLI) program installed by that package, you use the one from your virtual environment and not any other that could be installed globally, probably with a different version than what you need.

6. Install the CLI

uv pip install -e .

Usage

Interactive menu

footstats

Direct commands

footstats player "Cristiano Ronaldo"
footstats transfer-history "Lionel Messi"
footstats stats "Erling Haaland"

Options

footstats --help
footstats --version

Configuration

Copy .env.example to .env and adjust as needed:

USER_AGENT=Mozilla/5.0 (Windows NT 10.0; Win64; x64)...
ACCEPT_LANGUAGE=en-US,en;q=0.5
ACCEPT_ENCODING=gzip, deflate
REQUEST_DELAY=3.0   # seconds between requests — increase if getting blocked

Project Structure

footstats-scraper/
├── src/
│   ├── cli/
│   │   ├── main.py          # CLI entry point
│   │   └── utils/           # Display helpers
│   ├── models/              # Dataclasses
│   ├── providers/           # Scraping logic
│   └── utils/               # Config, parsing, requests
├── tests/
├── .env.example
├── pyproject.toml
└── README.md

Development

Run with Python:

# Run directly with python without installing
python -m src.cli.main [command] [argument]

Run with UV:

# Run directly with uv without installing
uv run python -m src.cli.main [command] [arguments]
"scr" "cli" "main" "command" "argument"
Root Parent Folder File you wanna run Action Passing argument, Ex. "cristiano"

Run Tests

# Run tests
pytest tests/test_providers.py ..

Disclaimer

This project is an independent open-source tool and is not affiliated with, endorsed by, or sponsored by Transfermarkt or any other data provider. Use it at your own risk and ensure compliance with their Terms of Service and avoid excessive requests. Please respect The REQUEST_DELAY setting in .env helps ensure responsible usage.

Users are solely responsible for ensuring that their use of this software complies with applicable laws, regulations, website terms of service, robots.txt policies, and rate-limiting requirements.

The authors provide this software for educational and research purposes only and make no representations regarding the legality or appropriateness of its use in any particular jurisdiction or against any particular website.


User Responsibility

By using this software, you acknowledge that you are responsible for determining whether your use complies with applicable laws, regulations, and the terms of service of any websites you access.

The authors are not responsible for how users choose to use this software.


Contributing

Contributions are welcome! Please open an issue before submitting a pull request so we can discuss the change.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'Add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

License

MIT License — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

footstats_cli-0.1.0.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

footstats_cli-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file footstats_cli-0.1.0.tar.gz.

File metadata

  • Download URL: footstats_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for footstats_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a9a676fb2bb08a4d18f2c4dd06ae25baea9be3892a6158a373f960c07bc047f
MD5 4180747c889d38c1cd15a4a9a8efffa1
BLAKE2b-256 e60268e9d833b57d87640c6593fdc39e53b17602efc624e2067df2f4c4ad1e5c

See more details on using hashes here.

File details

Details for the file footstats_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: footstats_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for footstats_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dea5bc601c4ced1d0e565aa3477d242224f5ed6190c500200be966cebcdcff59
MD5 27f808fe7bb33ad56bb894a828b2ea32
BLAKE2b-256 0db57b7c6b600032d9f395cdbf5dd30da29574978dc5f4eccdffadaf9f82ecce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page