Learn R Programming

⚠️There's a newer version (1.4.8) of this package.Take me there.

ffscrapr

An R Client for Fantasy Football League APIs

Helps access various Fantasy Football APIs (currently MFL, Sleeper, Fleaflicker, and ESPN - eventually Yahoo, potentially others) by handling authentication/rate-limiting/caching, forming appropriate calls, and returning tidy dataframes which can be easily connected to other data sources.

Installation

Install the stable version of this package from CRAN or the ffverse r-universe repository:

install.packages("ffscrapr") # CRAN
install.packages("ffscrapr", repos = "https://ffverse.r-universe.dev")

Install the development version from GitHub with:

remotes::install_github("ffverse/ffscrapr", ref = "dev")

The dev version has a separate documentation site here.

Usage

All ffscrapr functions start with a connection object created by ff_connect(), which stores connection, authentication, and other user-defined parameters. This object is used by all other functions to help return the correct data.

library(ffscrapr)
ssb <- ff_connect(platform = "mfl", league_id = "54040", season = 2020)

# Get a summary of league settings
ff_league(ssb) %>% str()

# Get rosters
ff_rosters(ssb)

# Get transactions
ff_transactions(ssb)

Platform-specific guides on getting started with ffscrapr are here:

There are also some more advanced guides for custom API calls in the Articles section, as well as some guides on optimizing ffscrapr’s performance.

Support

The best places to get help on this package are:

Contributing

Many hands make light work! Here are some ways you can contribute to this project:

Terms of Use

The R code for this package is released as open source under the MIT license.

The APIs and data accessed by this package belong to their respective owners, and are governed by their terms of use.

Copy Link

Version

Install

install.packages('ffscrapr')

Monthly Downloads

530

Version

1.4.7

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Tan Ho

Last Published

November 10th, 2021

Functions in ffscrapr (1.4.7)

dp_cleannames

Clean Names
dp_clean_html

Remove HTML from string
.fn_drop_nulls

Drop nulls from a list/vector
espn_getendpoint_raw

GET ESPN endpoint (raw)
.retry_get

Create RETRY version of GET
.sleeper_userid

Get Sleeper User ID
.fn_choose_season

Choose current season
espn_players

ESPN players library
.mfl_logincookie

Get MFL Login Cookie
.retry_post

Create RETRY version of POST
ff_draft

Get Draft Results
.fn_set_ratelimit

Set rate limit
ff_starter_positions

Get Starting Lineup Settings
fleaflicker_userleagues

Fleaflicker - Get User Leagues
ff_rosters

Get League Rosters
sleeper_getendpoint

GET any Sleeper endpoint
sleeper_connect

Connect to Sleeper League
fleaflicker_players

Fleaflicker players library
ff_playerscores

Get Player Scoring History
espn_potentialpoints

ESPN Potential Points
dp_name_mapping

Alternate name mappings
.fn_set_useragent

Set user agent
ff_starters

Get Starting Lineups
.sleeper_matchup

Individual sleeper matchup
sleeper_userleagues

Sleeper - Get User Leagues
fleaflicker_getendpoint

GET any Fleaflicker endpoint
fleaflicker_connect

Connect to Fleaflicker League
sleeper_players

Sleeper players library
espn_connect

Connect to ESPN League
ff_franchises

Get League Franchises
ff_league

Get League Summary
espn_getendpoint

GET ESPN fantasy league endpoint
ff_connect

Connect to a League
nflfastr_rosters

Import nflfastr roster data
mfl_getendpoint

GET any MFL endpoint
ff_template

Default conn objects
ff_transactions

Get League Transactions
dp_playerids

Import latest DynastyProcess player IDs
ff_schedule

Get Schedule
mfl_allrules

MFL rules library - memoised via zzz.R
mfl_connect

Connect to MFL League
ff_draftpicks

Get Draft Picks
ff_scoring

Get League Scoring Settings
nflfastr_stat_mapping

Mappings for nflfastr to fantasy platform scoring
nflfastr_weekly

Import latest nflfastr weekly stats
%>%

Pipe operator
mfl_players

MFL players library
dp_values

Import latest DynastyProcess values
ff_scoringhistory

Get League-Specific Scoring History
ff_standings

Get Standings
ff_userleagues

Get User Leagues
ffscrapr-package

ffscrapr: API Client for Fantasy Football League Platforms
release_bullets

Release questions
set_unescaped_cookies

Add unescaped cookies
.espn_stat_map

ESPN Stat ID map
.espn_pos_map

ESPN Primary Position map
.add_allplay

Add allplay from a standardised schedule output
.as_datetime

as_datetime
.espn_lineupslot_map

ESPN Lineup Slot map
.espn_activity_map

ESPN Activity/Transaction Mapping
.espn_team_map

ESPN Team ID map
.ff_clear_cache

Empty Function Cache