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_get_match_players does not return expected info #226

Closed
NikolasSotiriou opened this issue Nov 26, 2022 · 7 comments
Closed

fotmob_get_match_players does not return expected info #226

NikolasSotiriou opened this issue Nov 26, 2022 · 7 comments
Assignees

Comments

@NikolasSotiriou
Copy link

Hi! Awesome package first of all! A problem I have found is that the function fotmob_get_match_players does not return the info I would expect it to return for an upcoming match for which the lineups have not been announced yet. Specifically, the info I would expect is the predicted lineups which are available on the app.

library(worldfootballR)
packageVersion("worldfootballR")

# code which gets you a data frame containing the match IDs for the World Cup to use below
fotmob_matches <- as.data.frame(fotmob_get_league_matches(league_id = 77))
# the code below is for an upcoming match for which lineups have been announced
match_info1 <- as.data.frame(fotmob_get_match_players(fotmob_matches$id[23]))
# the code below is for an upcoming match for which predicted lineups are available
match_info2 <- as.data.frame(fotmob_get_match_players(fotmob_matches$id[24]))

sessionInfo()
@tonyelhabr
Copy link
Collaborator

hmm ok i'll have to take a look at this

@tonyelhabr tonyelhabr self-assigned this Dec 2, 2022
@JaseZiv JaseZiv closed this as completed in 9dfd1ac Dec 6, 2022
JaseZiv added a commit that referenced this issue Dec 6, 2022
Fix #226 (future match lineups from fotmob)
@NikolasSotiriou
Copy link
Author

Thanks for the quick turnaround. However, I think you fixed an issue different than the one I brought to light. Specifically, when I use this function for a match yet to happen but with a predicted lineup available on Fotmob, I do not that info. In fact, when I use this function for a match yet to happen, I do not even get the info that I used to get before I raised the issue (e.g. time, stadium). Anyway, thanks again.

@tonyelhabr
Copy link
Collaborator

When I ran this code with the PR that was merged, the Japan and Croatia match was not played yet. I thought you were looking for the upcoming lineups?

packageVersion("worldfootballR")
#> [1] '0.6.2.1000

options(tibble.print_min = 22)
fotmob_get_match_players(3370555) |> 
  dplyr::select(
    team_name,
    shirt,
    first_name,
    last_name,
    role
  )
# A tibble: 22 × 5
   team_name shirt first_name last_name role      
   <chr>     <chr> <chr>      <chr>     <chr>     
 1 Japan     12    Shuichi    Gonda     Keeper    
 2 Japan     16    Takehiro   Tomiyasu  Defender  
 3 Japan     3     Shogo      Taniguchi Defender  
 4 Japan     22    Maya       Yoshida   Defender  
 5 Japan     14    Junya      Ito       Attacker  
 6 Japan     13    Hidemasa   Morita    Midfielder
 7 Japan     17    Ao         Tanaka    Midfielder
 8 Japan     5     Yuto       Nagatomo  Defender  
 9 Japan     8     Ritsu      Doan      Attacker  
10 Japan     15    Daichi     Kamada    Midfielder
11 Japan     25    Daizen     Maeda     Attacker  
12 Croatia   4     Ivan       Perisic   Midfielder
13 Croatia   14    Marko      Livaja    Attacker  
14 Croatia   9     Andrej     Kramaric  Attacker  
15 Croatia   8     Mateo      Kovacic   Midfielder
16 Croatia   11    Marcelo    Brozovic  Midfielder
17 Croatia   10    Luka       Modric    Midfielder
18 Croatia   19    Borna      Sosa      Defender  
19 Croatia   20    Josko      Gvardiol  Defender  
20 Croatia   6     Dejan      Lovren    Defender  
21 Croatia   22    Josip      Juranovic Defender  
22 Croatia   1     Dominik    Livakovic Keeper 

@NikolasSotiriou
Copy link
Author

Example:
fotmob_matches <- as.data.frame(fotmob_get_league_matches(league_id = 77))
match_info <- as.data.frame(fotmob_get_match_players(fotmob_matches$id[58]))

With this code I get what I expect now that the lineups have been released for this match.
The issue I was raising is that I cannot get the predicted lineup (or any other info, in fact) for upcoming games for which the lineup has not been released yet but for which a predicted lineup is available on the app.

Example:

match_info <- as.data.frame(fotmob_get_match_players(fotmob_matches$id[59]))
match_info
[1] match_id
<0 rows> (or 0-length row.names)

@NikolasSotiriou
Copy link
Author

Also:

packageVersion("worldfootballR")
[1] ‘0.6.2’

@JaseZiv
Copy link
Owner

JaseZiv commented Dec 10, 2022

Also:

packageVersion("worldfootballR")

[1] ‘0.6.2’

Install the latest dev version using devtools::install_github("JaseZiv/worldfootballR") . The latest dev version as Tony said is 0.6.2.1000.

Let us know if the problem still persists after updating.

Thanks

@NikolasSotiriou
Copy link
Author

Worked. Thank you!

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

No branches or pull requests

3 participants