Fantasy Football Draft

Since 2010 I’ve been in a fantasy football keeper league. Each year we draft new players and often keep three per team; in the past Yahoo hasn’t been able to handle our specific league needs so I’ve been using a Google spreadsheet to keep track of the draft.

The spreadsheet is useful because it’s online so anyone can access it anywhere, it’s designed to handle teams in each column and rounds in each row, and the functionality to sort players and maintain some semblance of order with the 500+ players that can be chosen. It does have some downside since I have to set everything up manually every year then make sure the league managers follow the procedure to keep the draft going smoothly. As an alternative I’ve been pondering making my own web app (that honestly is going to steal plenty from Yahoo, shh don’t tell them) to use instead of a Google doc.

Things I want:

  • handle 500+ players including
    • name
    • team
    • position
    • projected draft round
    • projected season points
    • bye week (more useful then you’d think)
    • if they’re drafted or kept, by whom
  • 14 league managers that have
    • team owner
    • kept players
    • drafted players
    • players listed by position
  • no log-in (at least for now)
  • players displayed in an easily sorted manner
  • players drafted or kept are removed from the master list
  • players can be easily located by name or team
  • simple for managers to draft players
  • overall draft sheet showing teams in columns and rounds in rows
  • master player list showing their info
  • players listed by position

In my head it’s three sections: master player list, draft display, search area. Ideally on one page so no one has to swap pages but it might be too cluttered for those that don’t live in a 1080+p display world (heathens).

The base data needs to be persistent so a SQL database is the easy choice.

  • 2014 Keeper League draft (database name)
    • Players (table name)
      • Last Name (table rows)
      • First Name
      • Team
      • Bye
      • Position
      • Projected draft position
      • Projected season points
      • Drafted by
    • Teams (table name)
      • Owner
      • 1st round draft position

I’m unsure about how to go about changing the draft status of each player. Buttons? Drop-down list? Text box? Something to think about.

FF Keeper with GS

The good Google Script giveth and the good Google Script taketh away.

I can access Yahoo but only once. After that I’m locked out again. The credentials being created work off the bat but like a deep flyout to center field die on the way down. Somehow I’m missing the step that maintains access. What is the Google Script equivalent of cialis for oAuth connections? Where do I find digital bathtubs?

FF Keeper draft

I’ve finally successfully pulled *some* data from Yahoo’s servers. Behold, in all it’s glory:

<?xml version=”1.0″ encoding=”UTF-8″?>
<query xmlns:yahoo=”” yahoo:count=”1″ yahoo:created=”2013-06-03T22:20:20Z” yahoo:lang=”en-US”><results><game xmlns=””>
</game></results></query><!– total: 161 –>
<!– –>

While it looks like gibberish it contains the identifying number of the current (2013) NFL season (314) which I’ve been looking for since… oh I don’t know… last year sometime. BUT I FOUND IT NOW. With that I can build requests to access player data for specific fantasy leagues.

But you may ask yourself, “Self, if all the players are available in all the same leagues why do you need stats specific to a fantasy league, aren’t they all in the NFL?”

Good questions, Self. I need player data specific to each fantasy league because that’ll contain their points totals for that league’s scoring system so I can properly populate player data for the offline draft.

FF Keeper draft

Son of a. Javascript doesn’t usually play well with oauth requests (which Yahoo APIs need to verify identity because OH NOES THEY’LL STEAL MY FANTASY TEAM) but Google is one of those sites that should play well. The issue is security; typically local-run scripts (the code runs on the client not the server) has lots of holes for bad people to do bad things. I’d guess that since Google runs in the cloud this limits the security problem.

Good news, since getting stats straight from the horse’s mouth is the better way to do this. Now I have some code to troll though, if you’ll excuse me.

FF Keeper Draft

In my futile attempts to get access to closely guarded data, I may have to improvise. Yahoo isn’t keen on display EASILY AVAILABLE PLAYER STATS CONVERTED TO POINTS because they’re dumb, so I may avoid using Yahoo’s API’s all together and find another source of data.

Fortunately since the points are based off the stats, if I can’t get the points I’ll get the stats and convert it to points my-damn-self. Bye weeks cause another problem but that data is easily available as well. I just have to do the hard work of putting it all together.

At least, I think so. Go home Yahoo, you’re drunk.

FF keeper draft with Google Script (javascript)

Yahoo! doesn’t seem to handle keeper leagues well so I’m going to try to make things easier on myself; instead of wasting hours copying player stats into a Google spreadsheet I’m going to try to get the spreadsheet to do the work for me.

Inside of each Google spreadsheet is the ability to run background scripts when the page opens (or you tell it to). In this case I want to use my API keys to pull certain player data from their server, parse it into mutable objects, then populate the spreadsheet with the pertinent data (name, position, team, bye week, and expected points).

There are some other things I want to get to work, but this is the most time intensive on my end. This should also help with my other drafts, since Yahoo! doesn’t want to behave*.

*It may actually work properly, but this is way more fun and customizable for the other leagues I’m in too.