Methods
-
getBoxscoreForWeek (options)Array.<Boxscore>
-
Returns all boxscores for a week.
NOTE: Due to the way ESPN populates data, both the
scoringPeriodId
andmatchupPeriodId
are required and must correspond with each other correctly.Name Type Description options
object Required options object.
Name Type Description seasonId
number The season in which the boxscore occurs.
matchupPeriodId
number The matchup period in which the boxscore occurs.
scoringPeriodId
number The scoring period in which the boxscore occurs.
Returns:
Type Description Array.<Boxscore> All boxscores for the week -
getDraftInfo (options)Array.<DraftPlayer>
-
Returns all draft picks for a given season.
Name Type Description options
object Required options object.
Name Type Description seasonId
number The season in which the draft occurs.
scoringPeriodId
number optional The scoring period to pull player data from. Defaults to preseason.
Returns:
Type Description Array.<DraftPlayer> All drafted players sorted in draft order -
getFreeAgents (options)Array.<FreeAgentPlayer>
-
Returns all free agents (in terms of the league's rosters) for a given week.
NOTE:
scoringPeriodId
of 0 corresponds to the preseason;18
for after the season ends.Name Type Description options
object Required options object.
Name Type Description seasonId
number The season to grab data from.
scoringPeriodId
number The scoring period to grab free agents from.
Returns:
Type Description Array.<FreeAgentPlayer> The list of free agents. -
getHistoricalScoreboardForWeek (options)Array.<Boxscore>
-
Returns boxscores WITHOUT ROSTERS for PREVIOUS seasons. Useful for pulling historical scoreboards.
NOTE: This route will error for the current season, as ESPN only exposes this data for previous seasons.
NOTE: Due to the way ESPN populates data, both the
scoringPeriodId
andmatchupPeriodId
are required and must correspond with each other correctly.Name Type Description options
object Required options object.
Name Type Description seasonId
number The season in which the boxscore occurs.
matchupPeriodId
number The matchup period in which the boxscore occurs.
scoringPeriodId
number The scoring period in which the boxscore occurs.
Returns:
Type Description Array.<Boxscore> All boxscores for the week -
getHistoricalTeamsAtWeek (options)Array.<Team>
-
Returns an array of Team object representing each fantasy football team in a pre-2018 FF league.
NOTE: This route will error for the current season, as ESPN only exposes this data for previous seasons.
Name Type Description options
object Required options object.
Name Type Description seasonId
number The season to grab data from. This value must be before 2018
scoringPeriodId
number The scoring period in which to grab teams from.
Returns:
Type Description Array.<Team> The list of teams. -
getLeagueInfo (options)League
-
Returns info on an ESPN fantasy football league
Name Type Description options
object Required options object.
Name Type Description seasonId
number The season to grab data from.
Returns:
Type Description League The league info. -
getNFLGamesForPeriod (options)Array.<NFLGame>
-
Returns all NFL games that occur in the passed timeframe. NOTE: Date format must be "YYYYMMDD".
Name Type Description options
object Required options object.
Name Type Description startDate
string Must be in "YYYYMMDD" format.
endDate
string Must be in "YYYYMMDD" format.
Returns:
Type Description Array.<NFLGame> The list of NFL games. -
getTeamsAtWeek (options)Array.<Team>
-
Returns an array of Team object representing each fantasy football team in the FF league.
Name Type Description options
object Required options object.
Name Type Description seasonId
number The season to grab data from.
scoringPeriodId
number The scoring period in which to grab teams from.
Returns:
Type Description Array.<Team> The list of teams. -
Set cookies from ESPN for interacting with private leagues in NodeJS. Both cookies must be provided to be set. See the README for instructions on how to find these cookies.
Name Type Description options
object Required options object.
Name Type Description espnS2
string The value of the
espn_s2
cookie key:value pair to auth with.SWID
string The value of the
SWID
cookie key:value pair to auth with.