Skip to main content

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

  1. Python 3.6 or higher
  2. Google Chrome browser
  3. Chromedriver installed and added to your system's PATH

How to Use It

The library provides the following functions:

  1. Get data from the match URL in JSON format:
import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
match_data = whoscraped.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.

  1. Get all passes from both teams from a match URL or match json data:
import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
passes_df = whoscraped.get_match_passes(match_url)

or

import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
data = whoscraped.get_match_data(url)
passes_df = whoscraped.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.

  1. Get all stats from both teams from a match URL or match json data:
import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
stats_df = whoscraped.get_team_stats(match_url)

or

import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
data = whoscraped.get_match_data(url)
stats_df = whoscraped.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.

  1. Get shotmap of a match from its URL or json data:
import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
shots_df = whoscraped.get_shotmap(match_url)

or

import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
data = whoscraped.get_match_data(url)
shots_df = whoscraped.get_shotmap(data)

This function gets all the shots from a match and returns a Pandas DataFrame containing the information.

  1. Get players stats of a match from its URL or json data:
import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
stats_df = whoscraped.get_players_stats(match_url)

or

import whoscraped

match_url = "https://www.whoscored.com/Matches/1699239/Live/International-FIFA-World-Cup-2022-Argentina-France"
data = whoscraped.get_match_data(url)
stats_df = whoscraped.get_players_stats(data)

This function gets all the players individual stats from both teams 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


Download files

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

Source Distribution

whoscraped-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

whoscraped-0.2.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file whoscraped-0.2.0.tar.gz.

File metadata

  • Download URL: whoscraped-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for whoscraped-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3fa30fee8246dce7612d63483dc104de3f5ec22b22740d7a28af0d94bb9301a7
MD5 eda131e274a1b00e4d0ef4bb859b8566
BLAKE2b-256 2b7fd9b8f7d13e482b74c39da1674ae3e1651124689900b0f3ade3c69486afaa

See more details on using hashes here.

File details

Details for the file whoscraped-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: whoscraped-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for whoscraped-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67c1a8aca1b503ffcb23ae7ebfacf84b071e1975d6ec93fa177b9f2738979c57
MD5 da0563a97430a4c043b83f5adefac373
BLAKE2b-256 a0e963669f3409c4d932dc7a7e89030356938b18dc92ebc4a06b9ea9f25e3a5e

See more details on using hashes here.

Supported by

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