JaseZiv/worldfootballR

fb_league-stats - Specific League Bug

Closed this issue · 4 comments

Hello,

Seemed to have found a bug in the below code - seems to be working for other leagues I've tried so assume it is a league specific bug

Australia <- fb_league_stats(
country = "AUS",
gender = "M",
season_end_year = 2023,
tier = "1st",
non_dom_league_url = NA,
stat_type = "playing_time",
team_or_player = "player",
time_pause = 4

Warning message:
In f(...) :
Did not find the expected number of tables on the page (3). Found 0.

library(worldfootballR)
packageVersion("worldfootballR")
[1] ‘0.6.4.8’

this is due to our CSV here thinking that the current Australian season is 2022/2023. specifically, it says the season URL for the league is https://fbref.com/en/comps/65/A-League-Men-Stats instead of https://fbref.com/en/comps/65/2022-2023/2022-2023-A-League-Men-Stats.

Due to this, in the code here the URL is just https://fbref.com/en/comps/65/A-League-Men-Stats, which means that we try to scrape tables for the actual upcoming season for 2023/24, which has no data.

one fix could be to update the data source. but that can be brittle, because it relies on us updating the CSV at the correct cadences.

a different fix would be to generate the league URL from the comp_url and seasons fields from the CSV. this is not something we've traditionally done in the code base, but i think this might be a more robust solution.

Thanks for the update Tony,

Will this be rectified once the new season has started?

I will probably make a fix this weekend, if not earlier.

Out of curiosity, what do you use all the player stats for @kidshiva? I noticed you've posted about (valid) bugs for various leagues.

I make fantasy football models at the player level for approximately 20 fantasy football games - I am a stats nerd, lets put it that way!