-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfantasysports.go
4147 lines (3875 loc) · 161 KB
/
fantasysports.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//Fantasy Sports API
//
// Documentation from https://developer.yahoo.com/fantasysports/guide
package yahooapi
import (
"io/ioutil"
"log"
"net/http"
// "encoding/json"
"encoding/xml"
"fmt"
"github.com/gorilla/mux"
"golang.org/x/oauth2"
)
// `json:"myName,omitempty"`
// `json:"-"`
// `json:",string"` // float/int stored in json string
// `xml:"Group>Value"`
// `xml:"where,attr"` // pull from the attribute "where"
// Introduction to Fantasy Sports API
//
// The Fantasy Sports APIs provide URIs used to access fantasy sports data.
// Currently the APIs support retrieval of Fantasy Football, Baseball,
// Basketball, and Hockey data including game, league, team, and player
// information. The APIs are based on a RESTful model. Therefore, resources like
// game, league, team, player etc. and collections like games, leagues, teams,
// players form the building blocks for these APIs. Each resource is
// identified by a resource ID, and a collection is identified by its scope,
// specified in the URI.
//
// Historically, Yahoo! has provided two full draft and trade style fantasy
// football and baseball games – a free version, and a plus version (which
// contains more features and content). With the 2010 seasons, the Free and
// Plus versions of Football and Baseball have merged. Each game is comprised
// of many “leagues”, which typically contain 8-12 teams, which are managed by
// one or more users. At the beginning of a league’s season, professional
// athletes (“players”) are uniquely assigned or chosen through a draft to each
// team. The players that are not chosen or assigned are available to be
// acquired via a free-agent or waiver wire process (a “transaction”). These
// teams compete against each other based on statistics from real-world
// competitions based on categories like touchdowns, yards gained, batting
// average and ERA. Many fantasy sport rules can be set and changed within a
// league; for instance, the roster positions, statistics used to score,
// scoring modifiers, and game style are configurable.
//
// The game structure means that a lot of fantasy data is relevant only in the
// context of a particular league and team. For instance, without the league’s
// scoring rules, the statistics compiled by a player in a real-life competition
// are not meaningful to a particular league. Three rushing touchdowns by a
// running back is irrelevant to a league that only considers defensive players.
// Many leagues are private – the information about them is only available to
// users that are a members.
//
//
//OAuth
//
// If you’re going to use the Fantasy Sports APIs, you’re going to have to get a
// bit familiar with OAuth. OAuth is the authentication mechanism for these
// services that allows users to grant you permission to make requests on their
// behalf. Many other Yahoo! services use OAuth, and thus all of the underlying
// details are explained in exhaustive detail in our primary OAuth
// documentation. Of particular interest is the OAuth Authorization Flow, which
// explains where each request is made and where the user needs to get involved.
//
// However, constructing OAuth flows from scratch is complicated and easy to
// get wrong. It’s often easier to use existing libraries, which are available
// for most languages on the OAuth.net Code page.
//
//
// Registering Your Application
//
// To work with OAuth and Yahoo! services, you also must register your
// application with the Yahoo! Developer Network. When you register your
// application, you define a scope of Yahoo! services that your application
// will need access to, as well as the basic descriptive information that will
// be presented to users of your application when they’re asked to grant you
// permissions. You will be given a consumer key and secret value that will
// need to be fed into OAuth requests that you generate. You should be sure to
// keep these values secret, as anyone with access to them could masquerade as
// your application.
//
// To create a new OAuth application to use with the Fantasy Sports APIs, you
// should go through the New API Key flow on YDN. Be sure to specify that you
// need access to private user data, and select either Read or Read/Write access
// for Fantasy Sports.
//
//
// Resources and Collections
//
// Introduction
// The primary building blocks of the Fantasy Sports APIs are Resources and
// Collections. Resources typically describe chunks of data that can be
// identified by a unique key. Collections are simply wrappers that contain
// similar resources. So, for instance, if we need to retrieve data about a
// single league, we might ask for a League Resource and provide a single league
// key. However, if we wanted data across several leagues, we would ask for a
// Leagues Collection and provide multiple league keys.
//
// The format for requesting a Resource will typically look like:
//
// http://fantasysports.yahooapis.com/fantasy/v2/{resource}/{resource_key}
//
// While the format for requesting a Collection will typically look like:
//
// http://fantasysports.yahooapis.com/fantasy/v2/{collection};{resource}_keys={resource_key1},{resource_key2}
//
// Collections
// As mentioned, Collections are simply groups of Resources. If you care about
// particular Resources within a Collection, you can apply filters to the
// Collection to narrow the results. The most common type of filtering is by
// key. For instance, if you’d like to see two particular players, you could ask
// for them directly:
//
// /fantasy/v2/;player_keys=,{player_key2}
//
// Some Collections support more complex filters. Within a game, for example,
// you might ask for only the players that play a certain position. You could
// also request only the particular user who is currently logged in:
//
// /fantasy/v2/;use_login=1
//
// Sub-Resources
// Resources will typically define a list of valid Sub-Resources. These are
// Resources and Collections that can live within the scope of the parent
// Resource. For instance, a fantasy league in the Football draft and trade
// games can contain up to 20 fantasy teams; therefore, the League Resource can
// have a Teams Collection as a sub-resource. As a general rule of thumb, if you
// can possibly have multiple of one Resource contained within another Resource,
// then you’ll have a Collection of the first Resource as a sub-resource of the
// second Resource. You would only have a singular Resource as a sub-resource of
// another Resource if it would only make sense to ever ask for one instance of
// that Resource.
//
// The scope of a sub-resource is typically defined by the parent Resource; for
// instance, if you’re viewing a Players Collection as a sub-resource of a
// particular League, then you would expect to only see Players that are
// eligible within that League. Further filters could then be applied to this
// already narrowed list.
//
// Having sub-resources allows you to chain together Resources and Collections
// to provide more data, and the URI you request directly specifies how the
// chaining works. For instance, if you wanted to take a particular logged in
// user, see which games he had played, and then get the league information
// within those games, you might construct a request like:
// /fantasy/v2/;use_login=1//
//
// This would present you with a Users Collection, a single User Resource for
// the logged in user, a Games Collection for that user, potentially multiple
// Game Resources for each game the user is playing, a Leagues Collection
// beneath each Game Resource, and potentially multiple League Resources for
// each league the user belongs to in that game.
//
// When you specify a sub-resource beneath a Collection, you’re really saying
// that you’d like to see that sub-resource appended beneath each Resource
// within the Collection. Therefore, the sub-resources available to a
// Collection will be equivalent to the sub-resources available to the
// corresponding Resource.
//
// If you ever need to branch off other sub-resources outside of your main
// resource chain, you can use the out parameter, which will let you specify
// one level of extra sub-resources to pull in. At the moment, you cannot pass
// any parameters along to these out sub-resources, aside from any data that
// might get passed by default. This typically means that you can’t chain other
// resources off of sub-resources specified by the out parameter.
//
// As an example, if you wanted to view a league’s settings along with two teams
// in particular in a league, you might construct a URI like:
//
// /fantasy/v2//;out=settings/;team_keys=,{team_key2}
//
// Parameters
// Parameters can be provided to Resources and Collections as semicolon-
// delimited key-value pairs. These should be placed after the Resource or
// Collection name in the URI; in the case of entry-point Resources like Games,
// Leagues, Teams, and Players, the parameters belong after the resource_key.
// /fantasy/v2/{resource}/{resource_key};{key}={value};{key}={value}/{collection};{key}={value};{key}={value}/{collection};{key}={value}/{resource};{key}={value}
//
// Resource keys, out parameters, and other filters are just specific types of
// parameters that can be applied to various Resources or Collections.
//
// Game resource
//
// Description
// With the Game API, you can obtain the fantasy game related information, like
// the fantasy game name, the Yahoo! game code, and season.
//
// To refer to a Game resource, you’ll need to provide a game_key, which will
// either be a game_id or game_code. The game_id is a unique ID identifying a
// given fantasy game for a given season. For instance, the game_id for the Free
// NFL draft and trade fantasy game for the 2009 season is 222, while the
// game_id for the Plus version is 223. A game_code generally identifies a game,
// independent of season, and, when used as a game_key, will typically return
// the current season of that game. For instance, the game_code for the Free NFL
// game is nfl, and the game_code for the Plus game is pnfl; using nfl as your
// game_key during the 2010 season would be the same as providing the game_id
// for the 2010 season of the NFL game (242). As of the 2010 seasons, the Plus
// and Free games have been combined into a single code. Next year, the
// game_code nfl will point to the new game_id for the 2011 version of the NFL
// game. Thus, if you always want the current season of a game, the game_code
// should be used as a game_key.
//
// Below is a list of game IDs for most of our seasons of each game. If you’re
// looking for a current game ID that’s not listed in the table below, as
// mentioned above, you can request game information by game_code. For example:
//
// YQL: select * from fantasysports.games where game_key='nfl';
// API: http://fantasysports.yahooapis.com/fantasy/v2/game/nfl
// Game IDs Table
// Season nfl game ID pnfl game ID mlb game ID pmlb game ID nba game ID nhl game ID
// 2001 57 58 12 – 16 15
// 2002 49 62 39 44 67 64
// 2003 79 78 74 73 95 94
// 2004 101 102 98 99 112 111
// 2005 124 125 113 114 131 130
// 2006 153 154 147 148 165 164
// 2007 175 176 171 172 187 186
// 2008 199 200 195 196 211 210
// 2009 222 223 215 216 234 233
// 2010 242 – 238 – 249 248
// 2011 257 – 253 – 265 263
// 2012 273 – 268 – 304 303
//
// <?xml version="1.0" encoding="UTF-8"?>
// <fantasy_content xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/game/nfl" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" time="30.575037002563ms" copyright="Data provided by Yahoo! and STATS, LLC" xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng">
// <game>
// <game_key>257</game_key>
// <game_id>257</game_id>
// <name>Football</name>
// <code>nfl</code>
// <type>full</type>
// <url>http://football.fantasysports.yahoo.com/f1</url>
// <season>2011</season>
// </game>
// </fantasy_content>
//
type GameResource struct {
XMLName xml.Name `xml:"game",json:"-"`
Game_key string `xml:"game_key",json:",omitempty"`
Game_id string `xml:"game_id",json:",omitempty"`
Namecode string `xml:"namecode",json:",omitempty"`
Type string `xml:"type",json:",omitempty"`
Url string `xml:"url",json:",omitempty"`
Season string `xml:"season",json:",omitempty"`
Leagues []LeagueResource `xml:"leagues>league",json:",omitempty"`
Teams []TeamResource `xml:"teams>team",json:",omitempty"`
}
/*
HTTP Operations Supported
GET
URIs
http://fantasysports.yahooapis.com/fantasy/v2/game/
Any sub-resource under a game is extracted using a URI like:
http://fantasysports.yahooapis.com/fantasy/v2/game//
Multiple sub-resources can be extracted from game in the same URI using a
format like:
http://fantasysports.yahooapis.com/fantasy/v2/game/;out=,{sub_resource_2}
Game key format
{game_code} or {game_id}
Example:pnfl or 223
Note
If you specify a game_code as the game_key , we’ll translate that to the
corresponding game_id upon parsing the URI. Therefore, any game_code s will
be converted to game_id s in any keys returned by the Fantasy Sports APIs in
the response XML.
Sub-resources¶
Default sub-resource: metadata
Name Description URI Sample
metadata Includes game key, code, name, url, type and season. /fantasy/v2/game//metadata The 2009 Football PLUS game: http://fantasysports.yahooapis.com/fantasy/v2/game/223
Fetch specified leagues under a game. /fantasy/v2/game//leagues;league_keys=,{league_key2} A publicly viewable league within the 2009 football plus game: http://fantasysports.yahooapis.com/fantasy/v2/game/223/leagues;league_keys=223.l.431
Fetch specified players under a game. /fantasy/v2/game//players;player_keys=,{player_key2} Brett Favre’s information from the 2009 football plus game: http://fantasysports.yahooapis.com/fantasy/v2/game/223/players;player_keys=223.p.1025
game_weeks Start and end date information for each week in the game /fantasy/v2/game//game_weeks NFL game weeks http://fantasysports.yahooapis.com/fantasy/v2/game/nfl/game_weeks
stat_categories Detailed description of all available stat categories for the game. /fantasy/v2/game//stat_categories NFL stat categories http://fantasysports.yahooapis.com/fantasy/v2/game/nfl/stat_categories
position_types Detailed description of all player position types for the game. /fantasy/v2/game//position_types NFL position types http://fantasysports.yahooapis.com/fantasy/v2/game/nfl/position_types
roster_positions Detailed description of all roster positions for the game. /fantasy/v2/game//roster_positions NFL roster positions http://fantasysports.yahooapis.com/fantasy/v2/game/nfl/roster_positions
Sample XML¶
http://fantasysports.yahooapis.com/fantasy/v2/game/nfl
*/
/*
Games collection¶
Description¶
With the Games API, you can obtain information from a collection of games simultaneously. Each element beneath the Games Collection will be a Game Resource
HTTP Operations Supported¶
GET
URIs¶
URI Description Sample
http://fantasysports.yahooapis.com/fantasy/v2/games;game_keys=,{game_key2} Fetch specific games {game_key1} and {game_key2} nfl and mlb games: http://fantasysports.yahooapis.com/fantasy/v2/games;game_keys=nfl,mlb
http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games Fetch all games for the logged in user all games for user: http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games
http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys={game_key1},{game_key2} Fetch specific games {game_key1} and {game_key2} that the logged in user owns teams in. nfl and mlb games for user: http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys=nfl,mlb
Any sub-resource valid for a game is a valid sub-resource under the games collection.
Any sub-resource for a collection of games is extracted using a URI like:
/games/{sub_resource}
OR
/games;game_keys={game_key1},{game_key2}/{sub_resource}
Multiple sub-resources can be extracted from games in the same URI using a format like:
/games;out={sub_resource_1},{sub_resource_2}
OR
/games;game_keys={game_key1},{game_key2};out={sub_resource_1},{sub_resource_2}
Filters¶
The games collection can have filters such as the following to obtain a subset of a games collection that satisfy the filtering condition. These filters can be combined to obtain a more restricted list of games. For instance, if you wanted only the 2011 version of the nfl game, you might filter by seasons=2011 and game_codes=nfl.
Filter parameter Filter parameter values Usage
is_available 1 to only show games currently in season /games;is_available=1
game_types full|pickem-team|pickem-group|pickem-team-list /games;game_types=full,pickem-team
game_codes Any valid game codes /games;game_codes=nfl,mlb
seasons Any valid seasons /games;seasons=2011,2012
Sub-resources¶
In addition to the sub-resources valid for a game resource, the following are valid sub-resources for a games collection.
Name Description URI Sample
Fetch teams owned by a user for one or more games.
/fantasy/v2/users;use_login=1/games/teams
OR
/fantasy/v2/users;use_login=1/games;game_keys={game_key1},{game_key2}/teams
all teams for user: http://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games/teams
*/
// League resource
//
// Description
// When users join a Fantasy Football, Baseball, Basketball, or Hockey draft and
// trade game, they are organized into leagues with a limited number of friends
// or other Yahoo! users, with each user managing a Team. With the League API,
// you can obtain the league related information, like the league name, the
// number of teams, the draft status, et cetera. Leagues only exist in the
// context of a particular Game, although you can request a League Resource as
// the base of your URI by using the global ````. A particular user can only
// retrieve data for private leagues of which they are a member, or for public
// leagues.
type LeagueResource struct {
XMLName xml.Name `xml:"league",json:"-"`
LeagueKey string `xml:"league_key",json:",omitempty"`
LeagueID string `xml:"league_id",json:",omitempty"`
Name string `xml:"name",json:",omitempty"`
URL string `xml:"url",json:",omitempty"`
Password string `xml:"password",json:",omitempty"`
LeageChatID string `xml:"league_chat_id",json:",omitempty"`
DraftStatus string `xml:"draft_status",json:",omitempty"`
NumberOfTeams string `xml:"num_teams",json:",omitempty"`
EditKey string `xml:"edit_key",json:",omitempty"`
WeeklyDeadline string `xml:"weekly_deadline",json:",omitempty"`
LeagueUpdateTimestamp string `xml:"league_update_timestamp",json:",omitempty"`
ScoringType string `xml:"scoring_type",json:",omitempty"`
LeagueType string `xml:"league_type",json:",omitempty"`
Renew string `xml:"renew",json:",omitempty"`
Renewed string `xml:"renewed",json:",omitempty"`
ShortInvitationURL string `xml:"short_invitation_url",json:",omitempty"`
IsProLeague string `xml:"is_pro_league",json:",omitempty"`
CurrentWeek string `xml:"current_week",json:",omitempty"`
StartWeek string `xml:"start_week",json:",omitempty"`
StartDate string `xml:"start_date",json:",omitempty"`
EndWeek string `xml:"end_week",json:",omitempty"`
EndDate string `xml:"end_date",json:",omitempty"`
GameCode string `xml:"game_code",json:",omitempty"`
Season string `xml:"season",json:",omitempty"`
ScoreBoard ScoreBoardResource `xml:"scoreboard",json:",omitempty"`
}
type LeagueCollection struct {
XMLName xml.Name `xml:"fantasy_content",json:"-"`
Leagues []LeagueResource `xml:"leagues>league",json:",omitempty"`
Body string
}
// HTTP Operations Supported
// GET
//
// URIs
// http://fantasysports.yahooapis.com/fantasy/v2/league/
//
// Any sub-resource under a league is extracted using a URI like:
// http://fantasysports.yahooapis.com/fantasy/v2/league//
//
// Multiple sub-resources can be extracted from league in the same URI using a
// format like:
// http://fantasysports.yahooapis.com/fantasy/v2/league/;out=,{sub_resource_2}
//
// League key format
// .l.{league_id}
//
// Example:pnfl.l.431 or 223.l.431
//
// Note
// The separator between the game_key and league_id is a lower case L (not the
// number 1).
//
// Sub-resources
// Default sub-resource: metadata
//
// Name: metadata
// Description: Includes league key, id, name, url, draft status, number of
// teams, and current week information.
// URI: /fantasy/v2/league//metadata
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431
//
// Name: settings
// Description: League settings. For instance, draft type, scoring type, roster
// positions, stat categories and modifiers, divisions.
// URI: /fantasy/v2/league//settings
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/settings
//
// Name: standings
// Description: Ranking of teams within the league. Accepts Teams as a sub-
// resource, and includes team_standings data by default beneath
// the teams
// URI: /fantasy/v2/league//standings
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/standings
//
// Name: scoreboard
// Description: League scoreboard. Accepts Matchups as a sub-resource, which in
// turn accept Teams as a sub-resource. Includes team_stats data by
// default.
// URI: /fantasy/v2/league//scoreboard Scoreboard for current week
// /fantasy/v2/league//scoreboard;week={week} Scoreboard for a particular
// week
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/scoreboard;week=2
//
// Name:
// Description: All teams in the league.
// URI: /fantasy/v2/league//teams
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/teams
//
// Name:
// Description: The league’s eligible players.
// URI: /fantasy/v2/league//players
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/players
//
// Name: draftresults
// Description: Draft results for all teams in the league.
// URI: /fantasy/v2/league//draftresults
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/draftresults
//
// Name:
// Description: League transactions – adds, drops, and trades.
// URI: /fantasy/v2/league//transactions
// Sample: http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/transactions
//
//
// Sample XML
// http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431
// <?xml version="1.0" encoding="UTF-8"?>
// <fantasy_content xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" time="181.80584907532ms" copyright="Data provided by Yahoo! and STATS, LLC" xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng">
// <league>
// <league_key>223.l.431</league_key>
// <league_id>431</league_id>
// <name>Y! Friends and Family League</name>
// <url>http://football.fantasysports.yahoo.com/archive/pnfl/2009/431</url>
// <draft_status>postdraft</draft_status>
// <num_teams>14</num_teams>
// <edit_key>17</edit_key>
// <weekly_deadline/>
// <league_update_timestamp>1262595518</league_update_timestamp>
// <scoring_type>head</scoring_type>
// <current_week>16</current_week>
// <start_week>1</start_week>
// <end_week>16</end_week>
// <is_finished>1</is_finished>
// </league>
// </fantasy_content>
//
// http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/settings
// <?xml version="1.0" encoding="UTF-8"?>
// <fantasy_content xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng" xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/settings" time="86.472988128662ms" copyright="Data provided by Yahoo! and STATS, LLC">
// <league>
// <league_key>223.l.431</league_key>
// <league_id>431</league_id>
// <name>Y! Friends and Family League</name>
// <url>http://football.fantasysports.yahoo.com/archive/pnfl/2009/431</url>
// <draft_status>postdraft</draft_status>
// <num_teams>14</num_teams>
// <edit_key>17</edit_key>
// <weekly_deadline/>
// <league_update_timestamp>1262595518</league_update_timestamp>
// <scoring_type>head</scoring_type>
// <current_week>16</current_week>
// <start_week>1</start_week>
// <end_week>16</end_week>
// <is_finished>1</is_finished>
// <settings>
// <draft_type>live</draft_type>
// <scoring_type>head</scoring_type>
// <uses_playoff>1</uses_playoff>
// <playoff_start_week>14</playoff_start_week>
// <uses_playoff_reseeding>0</uses_playoff_reseeding>
// <uses_lock_eliminated_teams>0</uses_lock_eliminated_teams>
// <uses_faab>1</uses_faab>
// <trade_end_date>2009-11-27</trade_end_date>
// <trade_ratify_type>commish</trade_ratify_type>
// <trade_reject_time>0</trade_reject_time>
// <roster_positions>
// <roster_position>
// <position>QB</position>
// <count>1</count>
// </roster_position>
// <roster_position>
// <position>WR</position>
// <count>3</count>
// </roster_position>
// <roster_position>
// <position>RB</position>
// <count>2</count>
// </roster_position>
// <roster_position>
// <position>TE</position>
// <count>1</count>
// </roster_position>
// <roster_position>
// <position>W/R/T</position>
// <count>1</count>
// </roster_position>
// <roster_position>
// <position>K</position>
// <count>1</count>
// </roster_position>
// <roster_position>
// <position>DEF</position>
// <count>1</count>
// </roster_position>
// <roster_position>
// <position>BN</position>
// <count>4</count>
// </roster_position>
// </roster_positions>
// <stat_categories>
// <stats>
// <stat>
// <stat_id>4</stat_id>
// <enabled>1</enabled>
// <name>Passing Yards</name>
// <display_name>Pass Yds</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>5</stat_id>
// <enabled>1</enabled>
// <name>Passing Touchdowns</name>
// <display_name>Pass TD</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>6</stat_id>
// <enabled>1</enabled>
// <name>Interceptions</name>
// <display_name>Int</display_name>
// <sort_order>0</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>9</stat_id>
// <enabled>1</enabled>
// <name>Rushing Yards</name>
// <display_name>Rush Yds</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>10</stat_id>
// <enabled>1</enabled>
// <name>Rushing Touchdowns</name>
// <display_name>Rush TD</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>11</stat_id>
// <enabled>1</enabled>
// <name>Receptions</name>
// <display_name>Rec</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>12</stat_id>
// <enabled>1</enabled>
// <name>Reception Yards</name>
// <display_name>Rec Yds</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>13</stat_id>
// <enabled>1</enabled>
// <name>Reception Touchdowns</name>
// <display_name>Rec TD</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>15</stat_id>
// <enabled>1</enabled>
// <name>Return Touchdowns</name>
// <display_name>Ret TD</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>16</stat_id>
// <enabled>1</enabled>
// <name>2-Point Conversions</name>
// <display_name>2-PT</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>18</stat_id>
// <enabled>1</enabled>
// <name>Fumbles Lost</name>
// <display_name>Fum Lost</display_name>
// <sort_order>0</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>57</stat_id>
// <enabled>1</enabled>
// <name>Offensive Fumble Return TD</name>
// <display_name>Fum Ret TD</display_name>
// <sort_order>1</sort_order>
// <position_type>O</position_type>
// </stat>
// <stat>
// <stat_id>19</stat_id>
// <enabled>1</enabled>
// <name>Field Goals 0-19 Yards</name>
// <display_name>FG 0-19</display_name>
// <sort_order>1</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>20</stat_id>
// <enabled>1</enabled>
// <name>Field Goals 20-29 Yards</name>
// <display_name>FG 20-29</display_name>
// <sort_order>1</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>21</stat_id>
// <enabled>1</enabled>
// <name>Field Goals 30-39 Yards</name>
// <display_name>FG 30-39</display_name>
// <sort_order>1</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>22</stat_id>
// <enabled>1</enabled>
// <name>Field Goals 40-49 Yards</name>
// <display_name>FG 40-49</display_name>
// <sort_order>1</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>23</stat_id>
// <enabled>1</enabled>
// <name>Field Goals 50+ Yards</name>
// <display_name>FG 50+</display_name>
// <sort_order>1</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>24</stat_id>
// <enabled>1</enabled>
// <name>Field Goals Missed 0-19 Yards</name>
// <display_name>FGM 0-19</display_name>
// <sort_order>0</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>25</stat_id>
// <enabled>1</enabled>
// <name>Field Goals Missed 20-29 Yards</name>
// <display_name>FGM 20-29</display_name>
// <sort_order>0</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>29</stat_id>
// <enabled>1</enabled>
// <name>Point After Attempt Made</name>
// <display_name>PAT Made</display_name>
// <sort_order>1</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>30</stat_id>
// <enabled>1</enabled>
// <name>Point After Attempt Missed</name>
// <display_name>PAT Miss</display_name>
// <sort_order>0</sort_order>
// <position_type>K</position_type>
// </stat>
// <stat>
// <stat_id>31</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed</name>
// <display_name>Pts Allow</display_name>
// <sort_order>0</sort_order>
// <position_type>DT</position_type>
// <is_only_display_stat>1</is_only_display_stat>
// </stat>
// <stat>
// <stat_id>32</stat_id>
// <enabled>1</enabled>
// <name>Sack</name>
// <display_name>Sack</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>33</stat_id>
// <enabled>1</enabled>
// <name>Interception</name>
// <display_name>Int</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>34</stat_id>
// <enabled>1</enabled>
// <name>Fumble Recovery</name>
// <display_name>Fum Rec</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>35</stat_id>
// <enabled>1</enabled>
// <name>Touchdown</name>
// <display_name>TD</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>36</stat_id>
// <enabled>1</enabled>
// <name>Safety</name>
// <display_name>Safe</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>37</stat_id>
// <enabled>1</enabled>
// <name>Block Kick</name>
// <display_name>Blk Kick</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>50</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed 0 points</name>
// <display_name>Pts Allow 0</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>51</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed 1-6 points</name>
// <display_name>Pts Allow 1-6</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>52</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed 7-13 points</name>
// <display_name>Pts Allow 7-13</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>53</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed 14-20 points</name>
// <display_name>Pts Allow 14-20</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>54</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed 21-27 points</name>
// <display_name>Pts Allow 21-27</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>55</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed 28-34 points</name>
// <display_name>Pts Allow 28-34</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// <stat>
// <stat_id>56</stat_id>
// <enabled>1</enabled>
// <name>Points Allowed 35+ points</name>
// <display_name>Pts Allow 35+</display_name>
// <sort_order>1</sort_order>
// <position_type>DT</position_type>
// </stat>
// </stats>
// </stat_categories>
// <stat_modifiers>
// <stats>
// <stat>
// <stat_id>4</stat_id>
// <value>0.04</value>
// </stat>
// <stat>
// <stat_id>5</stat_id>
// <value>4</value>
// </stat>
// <stat>
// <stat_id>6</stat_id>
// <value>-1</value>
// </stat>
// <stat>
// <stat_id>9</stat_id>
// <value>0.1</value>
// </stat>
// <stat>
// <stat_id>10</stat_id>
// <value>6</value>
// </stat>
// <stat>
// <stat_id>11</stat_id>
// <value>.75</value>
// </stat>
// <stat>
// <stat_id>12</stat_id>
// <value>0.1</value>
// </stat>
// <stat>
// <stat_id>13</stat_id>
// <value>6</value>
// </stat>
// <stat>
// <stat_id>15</stat_id>
// <value>6</value>
// </stat>
// <stat>
// <stat_id>16</stat_id>
// <value>2</value>
// </stat>
// <stat>
// <stat_id>18</stat_id>
// <value>-1</value>
// </stat>
// <stat>
// <stat_id>57</stat_id>
// <value>6</value>
// </stat>
// <stat>
// <stat_id>19</stat_id>
// <value>3</value>
// </stat>
// <stat>
// <stat_id>20</stat_id>
// <value>3</value>
// </stat>
// <stat>
// <stat_id>21</stat_id>
// <value>3</value>
// </stat>
// <stat>
// <stat_id>22</stat_id>
// <value>4</value>
// </stat>
// <stat>
// <stat_id>23</stat_id>
// <value>5</value>
// </stat>
// <stat>
// <stat_id>24</stat_id>
// <value>-3</value>
// </stat>
// <stat>
// <stat_id>25</stat_id>
// <value>-1</value>
// </stat>
// <stat>
// <stat_id>29</stat_id>
// <value>1</value>
// </stat>
// <stat>
// <stat_id>30</stat_id>
// <value>-.5</value>
// </stat>
// <stat>
// <stat_id>32</stat_id>
// <value>1</value>
// </stat>
// <stat>
// <stat_id>33</stat_id>
// <value>2</value>
// </stat>
// <stat>
// <stat_id>34</stat_id>
// <value>2</value>
// </stat>
// <stat>
// <stat_id>35</stat_id>
// <value>6</value>
// </stat>
// <stat>
// <stat_id>36</stat_id>
// <value>2</value>
// </stat>
// <stat>
// <stat_id>37</stat_id>
// <value>2</value>
// </stat>
// <stat>
// <stat_id>50</stat_id>
// <value>10</value>
// </stat>
// <stat>
// <stat_id>51</stat_id>
// <value>7</value>
// </stat>
// <stat>
// <stat_id>52</stat_id>
// <value>4</value>
// </stat>
// <stat>
// <stat_id>53</stat_id>
// <value>1</value>
// </stat>
// <stat>
// <stat_id>54</stat_id>
// <value>0</value>
// </stat>
// <stat>
// <stat_id>55</stat_id>
// <value>-1</value>
// </stat>
// <stat>
// <stat_id>56</stat_id>
// <value>-4</value>
// </stat>
// </stats>
// </stat_modifiers>
// <divisions>
// <division>
// <division_id>1</division_id>
// <name>Family</name>
// </division>
// <division>
// <division_id>2</division_id>
// <name>Friends</name>
// </division>
// </divisions>
// </settings>
// </league>
// </fantasy_content>
func (y *YahooConfig) GetLeagueStandings(r *http.Request) *LeagueCollection {
session, err := y.SessionStore.Get(r, "session-name")
if err != nil {