View Latest: 1 Day | FISO Injury Search

Greasemonkey script to display team data on FPL league page

A Fantasy Football forum for news on fantasy football games run by the Premierleague (FPL).
Afunone
Cheetah
Posts: 6
Joined: 21 Aug 2018, 08:17
FS Record: 246387

Re: Greasemonkey script to display team data on FPL league page

Post by Afunone » 21 Aug 2018, 08:21

Really looking forward to this, nickchild. Thanks very much.

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 21 Aug 2018, 08:39

Have made good progress, just working on few of the other stats (transfers and chips) and figuring out the best way to calculate if a player appeared in their team's fixture.

I'm also struggling to program the on/off settings that allow users to toggle the stats that are displayed. This is due to the Greasemonkey engine changing how it handles the GM.setValue and GM.getValue events... So at the moment it is simply set up to display everything. If anyone has any experience using these new methods please send me a PM. Failing that, I will relaunch it with all stats visible while I try to build a workaround.

Hopefully should have an update released before the next gameweek...

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 23 Aug 2018, 17:40

Hi guys,

I have now updated the script and pushed it to the same location on userscripts, so anyone with it still installed should receive an update (you may need to do this manually if you have not set up automatic updates).

If not you can install it from this link - https://openuserjs.org/install/nickchil ... fo.user.js

Please let me know if you come across any bugs or errors (let me know which browser and extension you are using).

All previous functionality should be there, with the exception of the sortable table. I will look at reimplementing this over the coming days/weeks depending on other time commitments. Also the H2H data isn't in yet, but I'm not sure how widely used this was, apart from being useful to me!

The only stat I am having a problem with at the moment is the 'Played/To Play/Did Not Play' data. I am currently relying on the BPS stat from each players current gameweek, however any player who scored 0 will currently show as 'Did Not Play' as they simply don't appear in the data set. At the moment I have only come across Charlie Austin with 0 for the current gameweek, so bear this in mind when using that information.

If anyone knows where I can access the 'Minutes' data in the API for a given fixture or gameweek, please let me know and I will adjust the code accordingly.

Here's a quick summary of the functionality for clarity and those new to the script;

- Live score will show the gameweek score for each team as the week progresses, while live total adds the live score to the pre-gameweek score
- Captain information shows the active captain (hover for vice-captain)
- Played data will show you how many players that team has left to play during the gameweek (hover to see a breakdown of the specific players)
- Values (team, bank, total) show the current data (ie. including any price rise/increase/transfers)
- Gameweek transfer and transfer cost shows data for the transfers activated for the NEXT gameweek (ie. this count will reset to 0 as soon as a new gameweek starts)
- Chip info shows any chips previously played and those that are active for the current gameweek (an active chip is indicated by a pink highlight)
- Wildcard info shows if the wildcard is still available (ie. a tick shows their wildcard has not been played, while a cross shows it has been - hover over the icon to see which gameweek it was played)
- Squad list can be toggled for each team by clicking the 'T' in the position cell, or by clicking the 'T' at the top of the table to show/hide all squads
- Options at the bottom will turn the associated setting on or off (a refresh is required to update the view). Use the Quick Picks to display data relevant to either Team Info (value, transfer and chip info) or Live Info (live scores, captain, chips, wildard, played). There is also an 'Extra Wide' option if you are displaying all data as the table can get quite squashed otherwise

Due to the way FPL load the league tables, it may be necessary to perform a manual refresh on the page once your league table has initially loaded before the script will execute.

I have only tested this in Firefox (Greasemonkey), but the script 'should' work in the equivilent extensions in Chrome/Safari etc

Enjoy!

thesilkworm
Grumpy Old Man
Posts: 1554
Joined: 01 Oct 2009, 17:59

Re: Greasemonkey script to display team data on FPL league page

Post by thesilkworm » 23 Aug 2018, 18:10

From a quick test in Chrome, this looks great - thanks! Will be able to test it more thoroughly at the weekend when games are actually live, so will let you know if anything unexpected happens.

Regarding the Charlie Austin problem, how about this?

https://fantasy.premierleague.com/drf/event/2/live

CTRL-F "348" which is his player ID. You'll see that inside this object there's a "minutes": 57 stat. I can't confirm that this would be available while the gameweek is live as have never checked, but from the name of the URL I'd expect so.

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 23 Aug 2018, 18:20

Aha! That's perfect. Thanks thesilkworm. I knew it must be somewhere. It looks more reliable than parsing the fixture data as I am currently doing. Where do you find the available API calls? My source is obviously out of date!

Edit: Script updated

thesilkworm
Grumpy Old Man
Posts: 1554
Joined: 01 Oct 2009, 17:59

Re: Greasemonkey script to display team data on FPL league page

Post by thesilkworm » 23 Aug 2018, 18:34

I have this excellent post from Mav3rick bookmarked:

viewtopic.php?f=18&t=121295#p2911180

It's from two years ago so can't guarantee it's exhaustive or fully up-to-date. I don't think anything's changed though.

What I tend to do when looking for a particular data point is browse to an FPL page that I know must rely on that data point for it to function correctly, then open Chrome dev tools and view the XHR requests. The Points page (e.g. https://fantasy.premierleague.com/a/team/38510/event/2) would need live information on how many minutes Charlie Austin had played mid-game, and sure enough when I check the XHR requests we see that there's a request to https://fantasy.premierleague.com/drf/event/2/live.

thesilkworm
Grumpy Old Man
Posts: 1554
Joined: 01 Oct 2009, 17:59

Re: Greasemonkey script to display team data on FPL league page

Post by thesilkworm » 23 Aug 2018, 18:38

nickchild wrote:
23 Aug 2018, 18:20
Edit: Script updated
That was fast! Seems to work correctly now.

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 23 Aug 2018, 18:53

Lo and behold, I just found a different script that actually had the call to that '/live' method. Turns out I've been editing an older version of the script, pre API calls. The later one had a lot of the code I just re-wrote. I thought I had a weird sense of deja vu whilst coding this latest version....!!!

Just updated the script to show (C) and (vc) in the squad list.

I'll pick my way through the newer old script (!) to see if there was anything else I have missed or was doing better...

User avatar
sstaffsw
Grumpy Old Man
Posts: 1208
Joined: 08 Dec 2011, 10:47
Location: Wolverhampton

Re: Greasemonkey script to display team data on FPL league page

Post by sstaffsw » 23 Aug 2018, 19:55

Works brilliantly for me, thanks for spending the time and effort nickchild.

User avatar
jacksosi
Grumpy Old Man
Posts: 3600
Joined: 13 Oct 2005, 18:28
FS Record: TFF : 87th 06/07 ; FPL 1401st 08/09 ; hiding since...

Re: Greasemonkey script to display team data on FPL league page

Post by jacksosi » 23 Aug 2018, 20:34

Is there some way to use it on an iPhone? Cheers

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 23 Aug 2018, 21:09

jacksosi wrote:
23 Aug 2018, 20:34
Is there some way to use it on an iPhone? Cheers
Unfortunately not. No mobile browsers support userscripts. I did have an iOS app in the store up until this season but it's no longer available. It was costing me more to host the API and pay for my dev license than I was earning from it! I may rebuild it at some point...
Last edited by nickchild on 24 Aug 2018, 00:21, edited 1 time in total.

User avatar
MoSe
Dumbledore
Posts: 9187
Joined: 10 Sep 2014, 12:25
Location: next door S.Siro stadium
FS Record: FISODAS CUP Winner Season 25
FISO H2H Winner: 15/16 Div2 - 16/17 Div1
FISO Mirror: 16/17 PL Winner

Re: Greasemonkey script to display team data on FPL league page

Post by MoSe » 23 Aug 2018, 22:06

thesilkworm wrote:
23 Aug 2018, 18:34
I have this excellent post from Mav3rick bookmarked:

viewtopic.php?f=18&t=121295#p2911180

It's from two years ago so can't guarantee it's exhaustive or fully up-to-date. I don't think anything's changed though.
If you browse further in that topic, you'll find that FPL DID change some API URL (handle?) during the season, and there were contributions by RPG and eagle224 to track them.
Which I tried to summarise quoting them in a single post
viewtopic.php?p=3106984#p3106984
You yourself answered to nickchild already for a team line-up in the /picks api

thesilkworm
Grumpy Old Man
Posts: 1554
Joined: 01 Oct 2009, 17:59

Re: Greasemonkey script to display team data on FPL league page

Post by thesilkworm » 23 Aug 2018, 22:19

Ah great, thanks MoSe - bookmark updated :)

I should really read the whole thread at some point as I’m sure there’s some other stuff I’m not aware of.

User avatar
Fuzzy
FISOhead
Posts: 847
Joined: 24 Jul 2010, 10:28
Location: on a different wavelength
FS Record: meh

Re: Greasemonkey script to display team data on FPL league page

Post by Fuzzy » 23 Aug 2018, 23:12

Legend.

I am certain the whole community here appreciates the work you put into this nick.

Just made my mini league management duties simple again!

zomri
Wideboy
Posts: 54
Joined: 21 Aug 2013, 23:37

Re: Greasemonkey script to display team data on FPL league page

Post by zomri » 24 Aug 2018, 19:24

Hi Nick,
As you may know i have customised your script when you werent responding to community requests and was able to track where the API changes went. Please let me know if you need any help with this. I have added a funcionality to my version of tracking down if a manager has activated a wc or free hit chip as I think its useful for spying on opponents. Please let me know if tou are interested in adding this feature as well and you need any help.

The one thing that is still bugging me (pun intended) is these page load inconsistencies i get where data is randomly messed up for certain rows. Any chance you experienced the same issue and how to track it down? Any help greatly appreciated.

User avatar
supersonic
Red & Blue Braces
Posts: 323
Joined: 30 Aug 2011, 13:08

Re: Greasemonkey script to display team data on FPL league page

Post by supersonic » 24 Aug 2018, 19:32

Thanks as always Nick

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 25 Aug 2018, 12:49

I need to subtract transfer hits from live scores... all seems to be working OK otherwise

User avatar
Stemania
FISO Knight
Posts: 19700
Joined: 27 Aug 2006, 11:54
Location: On the Iron Throne of xG, the seat of The Crown Prince of the Stat Perverts. Or if not, in the STC!
FS Record: Best: TFF 321st. FPL 129th. FFS Career HoF 4th.

Re: Greasemonkey script to display team data on FPL league page

Post by Stemania » 25 Aug 2018, 12:57

Is this version 4.0.3 nick?

Afunone
Cheetah
Posts: 6
Joined: 21 Aug 2018, 08:17
FS Record: 246387

Re: Greasemonkey script to display team data on FPL league page

Post by Afunone » 25 Aug 2018, 13:47

Thanks, Nick. Very grateful.

Here's a screenshot of a little mini-league from about half-time in the Wolves v City game.

Image

It looks to me that 'Total transfers', 'Gameweek transfers' and 'Transfer points hit' are not working. Nearly everyone in that ML has made a transfer this GW (so that's the GWT column), and a few have points hits this GW (TPH column) and Total Transfers is clearly not right.

As an example, number 7 in this ML has made 3 transfers this GW for an 8-point hit. They have made 4 total transfers.

I don't mind at all, just reporting. It's a lovely script just to be able to see captains and squad values etc at a glance. And maybe the errors are to with other factors my end?

FPL get team info 4.0.3
Firefox 61.0.2
Violentmonkey 2.9.5

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 26 Aug 2018, 23:57

Good spot on the total transfers - I had been checking the chip count value as it wasn't displaying at first and hadn't removed it from that column! Fixed now.

As for the gameweek transfers and hit points - this reflects the transfers executed during the current gameweek (ie. ones that will affect the team in the next gameweek). This info is a bit more useful as the gameweek deadline approaches.

Afunone
Cheetah
Posts: 6
Joined: 21 Aug 2018, 08:17
FS Record: 246387

Re: Greasemonkey script to display team data on FPL league page

Post by Afunone » 27 Aug 2018, 22:52

Cheers, Nick - and thanks for the update.

From4corners
FISO Knight
Posts: 13767
Joined: 24 Aug 2009, 22:32
Location: The Eyrie

Re: Greasemonkey script to display team data on FPL league page

Post by From4corners » 01 Sep 2018, 17:21

nickchild wrote:
23 Aug 2018, 17:40
Hi guys,

I have now updated the script and pushed it to the same location on userscripts, so anyone with it still installed should receive an update (you may need to do this manually if you have not set up automatic updates).

If not you can install it from this link - https://openuserjs.org/install/nickchil ... fo.user.js

Please let me know if you come across any bugs or errors (let me know which browser and extension you are using).
Hey Nick, thanks for this!
The update didn't work for me, neither a re-install with the older one still active so reinstalled it from scratch, at least I tried to but receiving a Windows Script Host error (code 800A1391) and not sure how to get this great script back up and running again..

User avatar
andybarrell
Dumbledore
Posts: 7011
Joined: 13 Oct 2005, 18:26
Location: Southend-on-Sea
FS Record: 2013 Licence to Kill Winner
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by andybarrell » 01 Sep 2018, 19:33

hi Nick thanks for update

2 issues i have found using Chrome

When viewing any of my mini league tables , i then cannot go back to my team by clicking points

I get this when i view my H2H league
Capture.PNG
You do not have the required permissions to view the files attached to this post.

User avatar
andybarrell
Dumbledore
Posts: 7011
Joined: 13 Oct 2005, 18:26
Location: Southend-on-Sea
FS Record: 2013 Licence to Kill Winner
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by andybarrell » 02 Sep 2018, 08:14

player history page
Capture5.PNG
You do not have the required permissions to view the files attached to this post.

User avatar
sjaugen
Treebeard
Posts: 123
Joined: 09 Aug 2015, 18:04

Re: Greasemonkey script to display team data on FPL league page

Post by sjaugen » 04 Sep 2018, 10:40

I get a host of error messages. On Chrome with Tampermonkey.
Variables not defined, imflicit global variable etc.

I see that the script "activates" (red 1 marker on the top right TM icon in Chrome), but nothing is happening on the GUI side.
You do not have the required permissions to view the files attached to this post.

User avatar
nickchild
FISOhead
Posts: 648
Joined: 27 Jul 2006, 23:51
FS Record: 180th Overall FPL and X-League Winner 2008/09
Contact:

Re: Greasemonkey script to display team data on FPL league page

Post by nickchild » 06 Sep 2018, 10:45

It's still working OK for me... do you see the options below the table to turn the different data on/off? Are any of these set to 'on'?

User avatar
sjaugen
Treebeard
Posts: 123
Joined: 09 Aug 2015, 18:04

Re: Greasemonkey script to display team data on FPL league page

Post by sjaugen » 06 Sep 2018, 16:48

Hmm, works now for the first time. Might have been a conflict with Better FPL?
The error (?) messages are still there, but data is flowing in on the league site :)

User avatar
Stemania
FISO Knight
Posts: 19700
Joined: 27 Aug 2006, 11:54
Location: On the Iron Throne of xG, the seat of The Crown Prince of the Stat Perverts. Or if not, in the STC!
FS Record: Best: TFF 321st. FPL 129th. FFS Career HoF 4th.

Re: Greasemonkey script to display team data on FPL league page

Post by Stemania » 06 Sep 2018, 17:33

Working for me nc, and working great. Nice work! :D

I also recall having conflicts with BetterFPL before, but disabled it a while ago.

t88
Treebeard
Posts: 230
Joined: 01 Dec 2010, 23:05

Re: Greasemonkey script to display team data on FPL league page

Post by t88 » 07 Sep 2018, 10:49

Thx so much nc for this wonderful script! It's been extremely useful in doing analysis and comparing with others in my minileague.

One thing I noticed and this is just reporting it, I'm not complaining :)
I can't insert the screenshot but when displaying my minileague I'm seeing blank values in the following columns for some teams:
Cols: Value, Bank, Total, TT, GWT, TPH, WC, Chips

For other teams, all columns are showing correctly.
Btw I'm using firefox (greasemonkey)

Afunone
Cheetah
Posts: 6
Joined: 21 Aug 2018, 08:17
FS Record: 246387

Re: Greasemonkey script to display team data on FPL league page

Post by Afunone » 08 Nov 2018, 19:28

Nick, I've only just noticed this but I'm guessing it's been like this all the time ... When I click the little "T" to show the full teams in my minileague, the text runs out of space.

Like this:
Image

I realised because I did a Ctrl+F to find out how many people had Arnautovic and saw that one person who has him appeared not to have him (the 4th person in the league - with "Agüero (C)" at the end of the line). Then I looked closer and saw why. Arnie's name doesn't fit on the page.

All I could think to try was change the zoom scale of the page and refresh but that didn't change anything.

I'm using Violentmonkey on Firefox. Any ideas?

View Latest: 1 Day View Your posts
Post Reply

Return to “Fantasy PremierLeague.com (FPL)”

Who is online

Users browsing this forum: Bing [Bot], DAREEL, Gambit, MorrisonDullforce, Patf, SirMattBugsby, Stevieste, The Royal BlueNose and 47 guests