JaseZiv / worldfootballR

A wrapper for extracting world football (soccer) data from FBref, Transfermark, Understat
https://jaseziv.github.io/worldfootballR/
444 stars 60 forks source link

fotmob_get_league_matches() errors out #209

Closed cg86x closed 1 year ago

cg86x commented 1 year ago

Getting the below error with fotmob_get_league_matches().

Things worked fine for months but started to error out ~2 weeks ago.

league_matches <- fotmob_get_league_matches( 

country =     c("ENG", "GER", "ITA", "FRA", "ESP"),
league_name = c("Premier League", "1. Bundesliga", "Serie A", "Ligue 1", "LaLiga")

)
Error in clean_names.default(.) : 
  No `clean_names()` method exists for the class list
Consider janitor::make_clean_names() for other cases of manipulating vectors of names.
adlihs commented 1 year ago

I have the same issue!

tonyelhabr commented 1 year ago

What version of the package do you have? I can't replicate the issue with version 0.6.1.6000

library(worldfootballR)
packageVersion("worldfootballR")
#> [1] '0.6.1.6000'
league_matches <- fotmob_get_league_matches( 
  country =     c("ENG", "GER", "ITA", "FRA", "ESP"),
  league_name = c("Premier League", "1. Bundesliga", "Serie A", "Ligue 1", "LaLiga")
)
tail(league_matches)
#> # A tibble: 6 × 8
#>   month_key            round round_name page_url   id    home$…¹ away$…² statu…³
#>   <chr>                <int> <chr>      <chr>      <chr> <chr>   <chr>   <lgl>  
#> 1 Sunday, 04 June 2023    38 38         /match/39… 3918… Osasuna Girona  FALSE  
#> 2 Sunday, 04 June 2023    38 38         /match/39… 3918… Real B… Valenc… FALSE  
#> 3 Sunday, 04 June 2023    38 38         /match/39… 3918… Real M… Athlet… FALSE  
#> 4 Sunday, 04 June 2023    38 38         /match/39… 3918… Real S… Sevilla FALSE  
#> 5 Sunday, 04 June 2023    38 38         /match/39… 3918… Real V… Getafe  FALSE  
#> 6 Sunday, 04 June 2023    38 38         /match/39… 3918… Villar… Atleti… FALSE  
#> # … with 11 more variables: home$shortName <chr>, $id <chr>,
#> #   away$shortName <chr>, $id <chr>, status$started <lgl>, $cancelled <lgl>,
#> #   $scoreStr <chr>, $startDateStr <chr>, $startDateStrShort <chr>,
#> #   $reason <df[,2]>, $startTimeStr <chr>, and abbreviated variable names
#> #   ¹​home$name, ²​away$name, ³​status$finished
adlihs commented 1 year ago

The cran version is '0.6.1' packageVersion("worldfootballR") [1] ‘0.6.1’

cg86x commented 1 year ago

Same for me

image
cg86x commented 1 year ago

I restarted R - still got the same error. Then I quit R and reopened - same error. Restarted my computer and relaunched R and it ran without errors. Not sure if that will be a permanent fix but it works for now.

Mac OS 12.3.1 in case that is notable for any future investigation.

tonyelhabr commented 1 year ago

I restarted R - still got the same error. Then I quit R and reopened - same error. Restarted my computer and relaunched R and it ran without errors. Not sure if that will be a permanent fix but it works for now.

Mac OS 12.3.1 in case that is notable for any future investigation.

interesting. I would have expected that restarting R + RStudio would have been sufficient.

FWIW i can add some better error handling. from the current error message, it's not obvious the issue is related to JSON data retrieval.

tonyelhabr commented 1 year ago

@adlihs can you try downloading the development version of the package with remotes::install_github("JaseZiv/worldfootballR"), re-starting your R session + RStudio (if you're using it), then re-trying the function call?

i'm aware that this is not the CRAN version. we don't send updates to CRAN every time there is a code change. rather, we wait at least a few weeks so that we don't burden CRAN reviewers too much.

i believe the issue you're facing is due to Fotmob data format changes that occurred after we last submitted to CRAN

adlihs commented 1 year ago

It works! PC restarted R restarted RStudio restarted Using the development version

tonyelhabr commented 1 year ago

It works! PC restarted R restarted RStudio restarted Using the development version

Awesome. Hopefully we'll be pushing a new version of the package to CRAN soon. I realize that it can be confusing when the version of the package that you get with install.packages() doesn't work, but the development version does.