Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FotMob Scraping Warning #297

Closed
mcefis opened this issue Jul 3, 2023 · 4 comments · Fixed by #299
Closed

FotMob Scraping Warning #297

mcefis opened this issue Jul 3, 2023 · 4 comments · Fixed by #299
Assignees

Comments

@mcefis
Copy link

mcefis commented Jul 3, 2023

Good morning,

I had a problem with web scraping from FotMob; here below the warning:


**> Eredivisie_fotmob_rating <- fotmob_get_season_stats(

  • country = "NED",
  • league_name = "Eredivisie",
  • season_name = "2021/2022",
  • stat_name = "Assists",
  • team_or_player = "player"
  • )
    Error in map2():
    ℹ In index: 1.
    Caused by error in pmap():
    ℹ In index: 1.
    Caused by error in .fotmob_get_stat_and_season_options():
    ! Can't find season stats data. Failed with the following error:
    Can't find season stats data. Failed with the following error:
    Run rlang::last_trace() to see where the error occurred.
    Warning message:
    In sprintf("Can't find season stats data. Failed with the following error:\n", :
    one argument not used by format 'Can't find season stats data. Failed with the following error:**
    '

I have installed the last version of the library (worldfootballR_0.6.2). How can I fix this problem?

Let me know, many thanks.

Best regards,
Mattia

@tonyelhabr tonyelhabr self-assigned this Jul 7, 2023
@tonyelhabr
Copy link
Collaborator

Please install the latest version of worldfootballR (with remotes::install_github("JaseZiv/worldfootballR")) and let me know if you have the same issue.

I can't seem to replicate your issue with the latest version of the package.

library(worldfootballR)
packageVersion("worldfootballR")
#> [1] '0.6.3.8'
Eredivisie_fotmob_rating <- fotmob_get_season_stats(
  country = "NED",
  league_name = "Eredivisie",
  season_name = "2021/2022",
  stat_name = "Assists",
  team_or_player = "player"
)
dim(Eredivisie_fotmob_rating)
#> [1] 236  20

@mcefis
Copy link
Author

mcefis commented Jul 10, 2023

I followed your instruction but I still have an error:

library(worldfootballR)
packageVersion("worldfootballR")
[1] ‘0.6.3.8’
#1)Team stats
SerieA_team_stats_22_23 = fotmob_get_season_stats(

  • country = "ITA",
  • league_name = "Serie A",
  • season_name = "2022/2023",
  • stat_name = "xG conceded",
  • team_or_player = "team"
  • )
    Error: no applicable method for 'distinct' applied to an object of class "list"

Let me know, many thanks

@tonyelhabr
Copy link
Collaborator

the message that you see is because .fotmob_get_stat_and_season_options() tries to scrape data for 2023/24 since the season option is shown in the menu, but there is no data yet for it (here). i can eliminate the message by setting quiet = TRUE here to prevent confusion.

in reality, you should still be getting a valid result from your function call despite the error message. observe that i get a 20-row dataframe back from the function call.

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

res <- fotmob_get_season_stats(
  country = "ITA",
  league_name = "Serie A",
  season_name = "2022/2023",
  stat_name = "xG conceded",
  team_or_player = "team"
)
#> Error: no applicable method for 'distinct' applied to an object of class "list"
dim(res)
#> [1] 20 20

i may tackle this issue this weekend, but, as i've noted, you should still be getting valid data from the function call.

@mcefis
Copy link
Author

mcefis commented Jul 12, 2023

You're right, it was a refuse: now it works! Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants