⛏⚽ Scrape soccer data from Club Elo, ESPN, FBref, FiveThirtyEight, Football-Data.co.uk, FotMob, Sofascore, SoFIFA, Understat and WhoScored.
This version adds support for scraping FotMob and Understat.
The World Cup was added to the default available leagues for the WhoScored and FBref readers. Other tournaments can be added by modifying the league_dict.json
config file.
from soccerdata import WhoScored, FBref
ws = WhoScored(leagues="INT-World Cup", seasons="2022")
fb = FBref(leagues="INT-World Cup", seasons="2022")
WhoScored(..., headless=True)
.FBref has pages for the big five European leagues that allow you to more efficiently get team and player data from multiple leagues. This commit adds a special "Big 5 European Leagues Combined" league option to get data from these pages.
import soccerdata as sd
fbref = sd.FBref(leagues="Big 5 European Leagues Combined", seasons="20-21")
team_season_stats = fbref.read_team_season_stats(stat_type="standard")
player_season_stats = fbref.read_player_season_stats(stat_type="standard")
Previously, the fbref.read_team_season_stats
method visited the page of each individual team in a league to obtain stats for players in a league. FBRef now has a single page for each league/season where player stats can be obtained for each player in the league (e.g., https://fbref.com/en/comps/9/stats/Premier-League-Stats). Due to this change the fbref.read_team_season_stats(...)
method now uses 15-20x less requests, leading to a large speed-up.
A "opponent_stats" flag was added to the fbref.read_season_stats(...)
function, which enables retrieving the "Opponent Stats" table of a team.
FBRef is inconsistent in how it displays the "MP" (Matches Played) column. For some seasons, it is displayed as a separate category, while it is grouped under "Playing Time" for other seasons. This results in a column with NaN values when two seasons are merged. Therefore, the "MP" column is now always put under "Playing Time".
Not all Tor distribution use the same default port of 9050. The docs now describe how to configure a custom port.