Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Error in open.connection(con, "rb") #27

Open
ciya2326 opened this issue Jul 17, 2022 · 1 comment
Open

Error in open.connection(con, "rb") #27

ciya2326 opened this issue Jul 17, 2022 · 1 comment

Comments

@ciya2326
Copy link

ciya2326 commented Jul 17, 2022

Hello.

I am currently working on a project that has an optimal selection of FPL players and has been using the fplscrapR package. It is great and allows easy access to data.
I'm trying to use it to get the player's score for each game week for the last three years, but I'm having some problems trying to understand how to use the function and run an example of it.

get_entry_player_picks(1076,1)
Error in open.connection(con, "rb") : HTTP error 404.

(Articles: https://wiscostret.github.io/fplscrapR/articles/hazalexishist.html)

df <- get_player_hist ( playerid = get_player_id ( c ( "Mesut Özil" , "Juan Mata" ))$ id )
Error in open.connection(con, "rb") : cannot open the connection
In addition: Warning message:
In open.connection(con, "rb") :
cannot open URL 'https://fantasy.premierleague.com/api/element-summary/NA/': HTTP status was '404 Not Found'

I initially thought the problem was on my computer and tried turning off the windows firewall, but I still can't get the data. Has anyone else had the same problem recently? If you have any time to get back to me I would be very grateful.

@wiscostret
Copy link
Owner

Hi there,

I will update some of the vignettes, hopefully before the season starts, because I can see how they may cause confusion like here.

Simply, the errors you get are because:

  1. get_entry_player_picks() won't work before Gameweek 1. This function fetches player picks for a given entry (team). But since the season hasn't started, there aren't any player picks. So you'll have to wait for Gameweek 1.

  2. get_player_hist() only works for players currently in the game. If you run get_player_hist(playerid = get_player_id("Mohamed Salah")$id), that will work. You can access data from prior season through several package functions, e.g. get_player_info() or get_player_details() by specifying the 'season' parameter.

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

No branches or pull requests

2 participants