bobbymond / FantasyPremierLeagueAPI

A C# API for accessing data for Fantasy Premier League
MIT License
22 stars 4 forks source link

API taken down #3

Open comistet opened 7 years ago

comistet commented 7 years ago

It looks like the fantasy stats API (e.g. https://fantasy.premierleague.com/web/api/elements/222/) has been taken down. Do you know how else we can get this data?

bobbymond commented 7 years ago

Looks like there is something here: https://fantasy.premierleague.com/drf/element-summary/ Haven't dug in yet to check if that's the same thing or not. Looks like the whole site has been redesigned so might need to fix some of the other site scraping stuff.

LazyTarget commented 7 years ago

I've researched a bit and the data can easily be accessed by simple GET requests.

Base url: https://fantasy.premierleague.com/drf/

Relative links: /bootstrap (more data if authenticated) /bootstrap-static /bootstrap-dynamic

/events /elements /element-types /fixtures /teams /region /transfers (requires auth) /entry/{entryId} /entries (doesn't work in pre-season?) /my-team/{teamId} (requires auth) /leagues-entered/{teamId} (requires auth) /leagues-classic/{leagueId} (must be a member) /leagues-classic-standings/{leagueId} /leagues-h2h/{leagueId} (must be a member) /leagues-h2h-standings/{leagueId}

I'll see if I have the time to try and implement these in a pull-request.

LazyTarget commented 7 years ago

Don't know if there are any API's for updating the squad or making transfers.

Also not entirely sure whether if the authentication is handled by cookie or through request credentials.

LazyTarget commented 7 years ago

I have begun with some updates on my fork.

mattdunndc commented 7 years ago

Any idea what the columns ep_this, ep_next or ea_index mean?

gpoudel commented 7 years ago

"Estimated points this Game Week" and "Estimated Points Next Game Week". They could be working on some predictive modeling idea but this could be very simple formula.

tommed commented 7 years ago

Can I suggest doing a HEAD request rather than a GET will rapidly improve performance. When it returns a 200 the player exists, when it returns a 404, they don't. Then you can request the GETs.

Qd7 commented 7 years ago

if any is looking to get data in excel,

using Lazytarget post, i found this https://fantasy.premierleague.com/drf/entry/{teamId}/history

you can use excel power query to parse the json and link it to excel as a table

brood915 commented 7 years ago

Hm how did you guys deal with the CORS problem? I cant access any data

andrew3stedall commented 7 years ago

Would you be able to help with authentication over php?

tommed commented 7 years ago

@brood915, you either request these at the server (so CORs doesn't apply), and/or create you're own proxy with CORs enabled. Either way, you'll need a server component to delegate the calls, you can't just develop a front-end and plug into these API calls.

tanushshukla commented 6 years ago

@LazyTarget , I checked your fork as well. It's not working. https://github.com/LazyTarget/FantasyPremierLeagueAPI

Is it normal? Didn't debug much but only one cookie is getting set.

al3krab1 commented 6 years ago

/transfers (requires auth) !! how can i get auth in my website?

Heri88 commented 6 years ago

Anyone able to get auth api?

PierreBoislard3 commented 5 years ago

Anyone found how to get auth on external website?

chris-mann-uk commented 5 years ago

Has anybody taken a look at this recently?

The API appears to have changed again, leaving all links previously mentioned null and void.

ap752-unikent commented 4 years ago

Has anybody taken a look at this recently?

The API appears to have changed again, leaving all links previously mentioned null and void.

Yeah, I've noticed this as well. I'm hoping this is just because the season hasn't started yet. If the API has changed however, how did you guys find the new one last time?

ap752-unikent commented 4 years ago

nvm, I think I found it

https://fantasy.premierleague.com/api/bootstrap-static/

For future reference, if you look at the network tab on chrome and record the traffic coming in when you load the page, then you can view all the pages being called. The api calls will be here

lastmaj commented 4 years ago

nvm, I think I found it

https://fantasy.premierleague.com/api/bootstrap-static/

For future reference, if you look at the network tab on chrome and record the traffic coming in when you load the page, then you can view all the pages being called. The api calls will be here

I think it loads just the one. The only other endpoint I could have found was : https://fantasy.premierleague.com/api/fixtures/. Please share if you can find others as well.

ScottBruton commented 4 years ago

Hey guys, I carry on receiving “Authentication credentials were not provided” , and then I can’t access any data from leagues.. can anyone help?

ap752-unikent commented 4 years ago

nvm, I think I found it https://fantasy.premierleague.com/api/bootstrap-static/ For future reference, if you look at the network tab on chrome and record the traffic coming in when you load the page, then you can view all the pages being called. The api calls will be here

I think it loads just the one. The only other endpoint I could have found was : https://fantasy.premierleague.com/api/fixtures. Please share if you can find others as well.

You can also find each player's individual attributes by sending a request to "https://fantasy.premierleague.com/api/element-summary/{player-id}/"

Each players id can be found via the api call to boostrap static

ap752-unikent commented 4 years ago

Hey guys, I carry on receiving “Authentication credentials were not provided” , and then I can’t access any data from leagues.. can anyone help?

That's odd, still working for me. Just to make sure, you're sending a GET request not a POST right?

Qd7 commented 4 years ago

Hi all,

any chance anyone can help us with step-by-step import these json links into Excel?

Regards


From: Ahmed Mejbri notifications@github.com Sent: 26 August 2019 20:00 To: bobbymond/FantasyPremierLeagueAPI FantasyPremierLeagueAPI@noreply.github.com Cc: Qd7 asqbloker@hotmail.com; Comment comment@noreply.github.com Subject: Re: [bobbymond/FantasyPremierLeagueAPI] API taken down (#3)

nvm, I think I found it

https://fantasy.premierleague.com/api/bootstrap-static/

For future reference, if you look at the network tab on chrome and record the traffic coming in when you load the page, then you can view all the pages being called. The api calls will be here

I think it loads just the one. The only other endpoint I could have found was : https://fantasy.premierleague.com/api/fixtures. Please share if you can find others as well.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/bobbymond/FantasyPremierLeagueAPI/issues/3?email_source=notifications&email_token=AFQ4A5HF7CVPYZ66A6KKYLDQGQD37A5CNFSM4CKHDDU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5E7L4I#issuecomment-524940785, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFQ4A5DXLOJEFZ7N5FYPWW3QGQD37ANCNFSM4CKHDDUQ.

lastmaj commented 4 years ago

Hey guys, I carry on receiving “Authentication credentials were not provided” , and then I can’t access any data from leagues.. can anyone help?

That's odd, still working for me. Just to make sure, you're sending a GET request not a POST right?

Yes, if a an authenticated user browses his league standings, the league standings API endpoint returns data but only for a minute or so, but generally it requires authentication. Basically you need to send a post req with authentication details to a certain URL and then capture the cookies from the response and use them for all subsequent queries : https://medium.com/@bram.vanherle1/fantasy-premier-league-api-authentication-guide-2f7aeb2382e4