How federicorabanos/lanusstats works
Project Type and Purpose
• This is a domain-specific Python library (SDK) named “LanusStats” for scraping football data and producing quick visualizations.
• It provides a unified API over five data sources (FBRef, FotMob, SofaScore, 365Scores, Transfermarkt) plus plotting utilities via a visualizations module.
• Users install via pip and call high-level functions or instantiate scraper classes to get pandas DataFrames or charts.
File-Structure Analysis
• Top level
• .github/workflows/publish-package.yml – CI/CD pipeline to run tests/build and publish to PyPI.
• setup.py – package metadata, dependencies and entry points.
• README.md – user documentation and examples.
• LanusStats/ package
• config.py – constants, URL templates, selectors.
• datafactory.py – factory that, given a page name, returns the right scraper instance.
• exceptions.py – custom exception types for error handling across scrapers.
• functions.py – generic helper functions (e.g., get_available_pages, get_available_leagues).
• fbref.py, fotmob.py, sofascore.py, threesixfivescores.py, transfermarkt.py – one scraper class per data source, each implementing a common interface (request → parse → DataFrame).
• visualizations.py – plotting routines that wrap scraping calls and chart with Matplotlib/MPLSoccer.
Key README Insights
• Each scraper class exposes methods like get_teams_season_stats, get_player_season_stats, get_match_shotmap, etc.
• The library returns pandas DataFrames (optionally saved to CSV/XLSX) or Matplotlib figures (optionally saved).
• There’s a clear layering: user API → datafactory/functions → scraper classes → HTTP requests → HTML parsing → DataFrame → optional visualization.