No project description provided
Project description
FBRef Scraper
Description
FBRef Scraper is a Python package designed to scrape data from the website FBRef. It utilizes Poetry for package management and Typer for building a command-line interface to facilitate scraping.
Installation
Install this package inside a Virtual Environment :
# pip
pip install football-analytics
#poetry
poetry add football-analytics
Usage
To run the scraper, use the following command:
fbref-scrap COMMAND
Replace COMMAND with the specific functionality you want to use.
Available Commands
- main: Initiates the scraping process. It's instantiated in a callback function, so no need to precise "main" when calling fbref-scrap command.
- Add more commands here as you develop additional functionality.
Precision on the main command
Docstring to the main function :
Typer command running the main function, called scraping_data_games.
Args:
start_date (str, optional): first date to be scrapped, should be YYYYMMDD. Defaults to "20240101".
end_date (Union[str, None], optional): last date to be scrapped, should be YYYYMMDD. Defaults to None.
db_config_path (Union[str, None], optional): Path to the config file, should be a .ini file with a [postgresql] header. If filed, we consider you want to save the output to the related database. Defaults to None.
Let's provide some examples on how you can run it.
# Run the scraper on January 1st 2024 (default date) only, no output are saved.
fbref-scrap
# Run the scraper on May 6th 2024 only, no output are saved.
fbref-scrap --start-date 20240506
# Run the scraper on all dates from May 6th 2024 to May 13th 2024.
fbref-scrap --start-date 20240506 --end-date 20240513
# Run the scraper on all dates from May 6th 2024 to May 13th 2024, then look to a config file called database.ini (relatively to where you are when calling the scraper) to export the output to a PostGreSQL database
fbref-scrap --start-date 20240506 --end-date 20240513 --db-config-path database.ini
Configuration
The only configuration you might need is creating a PostGreSQL database to export the results of the main command. If you don't have a PostgreSQL setup already, you can do the following :
- Install PostGreSQL. You can follow this tutorial which is nice and simple : https://www.youtube.com/watch?v=PShGF_udSpk
- Create a database manually, you can call it
FootballAnalyticsfor example. - Create a ini file, it can be named
database.ini. - Push to the branch (git push origin feature/your-feature).
- Create a new Pull Request.
Expected template of the ini file :
[postgresql]
host=localhost
database=FootballAnalytics
user=your_psql_user_name
password=your_psql_password
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create your feature branch (git checkout -b feature/your-feature).
- Commit your changes (git commit -am 'Add some feature').
- Push to the branch (git push origin feature/your-feature).
- Create a new Pull Request.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file football_analytics-0.2.0.tar.gz.
File metadata
- Download URL: football_analytics-0.2.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
081f9ab6bd79efb3765c5bf9fc7fa1a3c864e68e8b77c768bfd6daa5d23b2983
|
|
| MD5 |
8a5387b321030a84c0385bc114a4efea
|
|
| BLAKE2b-256 |
917293a0577bcd22fd35ed0327983167f86062f6abaeec5b4616df17f29a964c
|
File details
Details for the file football_analytics-0.2.0-py3-none-any.whl.
File metadata
- Download URL: football_analytics-0.2.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d551cc2fac1bda7d2cac457ed4042701faf8320970471a50ee6309935804ec
|
|
| MD5 |
8985e22d7d7be32771c1b2cc6cacbf9d
|
|
| BLAKE2b-256 |
d61e64ee185ebb1029a58c7ad3c1f55243c40405040522fd8fa54654d99a0b79
|