Scrape football data from WhoScored
Project description
WhoScraped
Library for scraping football data from WhoScored matches.
Installation
To install this library, use:
pip install whoscraped
To upgrade the library, use:
pip install --upgrade whoscraped
Prerequisites
- Python 3.6 or higher
- Google Chrome browser
- Chromedriver installed and added to your system's PATH
How to Use It
The library provides the following functions:
- Get data from the match URL in JSON format:
from whoscraped import get_match_data
match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
match_data = get_match_data(match_url)
This function retrieves match data from the specified URL. The data is returned as a Python dictionary in JSON format.
- Get all passes from both teams from a match URL or match json data:
from whoscraped import get_match_passes
match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
passes_df = get_match_passes(match_url)
or
from whoscraped import get_match_data, get_match_passes
match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
data = get_match_data(url)
passes_df = get_match_passes(data)
This function gets all pass events from the specified match URL or json object with match data and returns a Pandas DataFrame containing the pass information.
- Get all stats from both teams from a match URL or match json data:
from whoscraped import get_team_stats
match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
stats_df = get_team_stats(match_url)
or
from whoscraped import get_match_data, get_team_stats
match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
data = get_match_data(url)
stats_df = get_team_stats(data)
This function gets all the home and away team stats from the specified match URL or json object with match data and returns a Pandas DataFrame containing the information.
Handling Errors
If you encounter an error, such as CantGetMatchData, ensure that the match URL is correct and that the WhoScored page has the necessary data.
Contributing
If you would like to contribute to this project, please fork the repository and submit a pull request. Ensure that your code passes all tests and adheres to the project's coding standards.
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
File details
Details for the file whoscraped-0.1.0.tar.gz
.
File metadata
- Download URL: whoscraped-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7591a5cb6a2aa11782772dfb36cb83f878b68df1a8951b2e0a2df3572b5cbd8a |
|
MD5 | cdcfbb40d7e4961af55e0a698173f718 |
|
BLAKE2b-256 | 68bdfc996740505b448298c602f2bc1592afc9faf0bfdcfcbfe45c9f239fd8cd |
File details
Details for the file whoscraped-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: whoscraped-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2121ada96453af42f764d85bf1291b7e87bb7d52071b7e88e991bbae14a5d714 |
|
MD5 | cb255d3aaafa3ebd96832512285147c4 |
|
BLAKE2b-256 | ba3ece3a58a25c2cdc5b0862ce5df78df6d1ca379d17abb48c6423c0538b7af2 |