JaseZiv / worldfootballR

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

Error in fotmob_get_league_matches #237

Closed mbrownsword closed 1 year ago

mbrownsword commented 1 year ago

Getting this error when trying to pull match data, there's an encoding issue in the link that you can solve but not gor fotmob_get_league_matches.

Error in .fotmob_get_league_urls(leagues = leagues, ...) : Could not find any leagues matching specified parameters. In addition: Warning messages: 1: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : invalid input found on input connection 'https://raw.githubusercontent.com/JaseZiv/worldfootballR_data/master/raw-data/fotmob-leagues/all_leagues.csv' 2: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : EOF within quoted string 3: In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : invalid input found on input connection 'https://raw.githubusercontent.com/JaseZiv/worldfootballR_data/master/raw-data/fotmob-leagues/all_leagues.csv'

tonyelhabr commented 1 year ago

Please make sure that you have the latest version of {worldfootballR}, which you can get with remotes::install_github("JaseZiv/worldfootballR"). I don't have that issue on the latest version of the package.

library(worldfootballR)
packageVersion("worldfootballR")
#> [1] '0.6.2.4000'

fotmob_get_league_matches(
  country = "ENG",
  league_name = "Premier League"
)
#> # A tibble: 380 × 7
#>    round round_name page_url                       id    home$…¹ away$…² statu…³
#>    <int> <chr>      <chr>                          <chr> <chr>   <chr>   <chr>  
#>  1     1 1          /match/3900932/matchfacts/cry… 3900… Crysta… Arsenal 2022-0…
#>  2     1 1          /match/3900933/matchfacts/ful… 3900… Fulham  Liverp… 2022-0…
#>  3     1 1          /match/3900934/matchfacts/afc… 3900… AFC Bo… Aston … 2022-0…
#>  4     1 1          /match/3900935/matchfacts/lee… 3900… Leeds … Wolver… 2022-0…
#>  5     1 1          /match/3900937/matchfacts/new… 3900… Newcas… Nottin… 2022-0…
#>  6     1 1          /match/3900938/matchfacts/tot… 3900… Totten… Southa… 2022-0…
#>  7     1 1          /match/3900939/matchfacts/eve… 3900… Everton Chelsea 2022-0…
#>  8     1 1          /match/3900936/matchfacts/lei… 3900… Leices… Brentf… 2022-0…
#>  9     1 1          /match/3900940/matchfacts/man… 3900… Manche… Bright… 2022-0…
#> 10     1 1          /match/3900941/matchfacts/wes… 3900… West H… Manche… 2022-0…
#> # … with 370 more rows, 9 more variables: home$shortName <chr>, $id <chr>,
#> #   away$shortName <chr>, $id <chr>, status$finished <lgl>, $started <lgl>,
#> #   $cancelled <lgl>, $scoreStr <chr>, $reason <df[,2]>, and abbreviated
#> #   variable names ¹​home$name, ²​away$name, ³​status$utcTime

Created on 2023-01-03 with reprex v2.0.2