knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) options(tibble.print_min = 5, pillar.bold = TRUE, pillar.min_chars = 25, pillar.min_title_chars = 25, dplyr.summarise.inform = FALSE, rmarkdown.html_vignette.check_title = FALSE) # # eval <- TRUE # # tryCatch(expr = { # # download.file("https://github.com/ffverse/ffscrapr-tests/archive/1.4.7.zip","f.zip") # unzip('f.zip', exdir = ".") # # httptest::.mockPaths(new = "ffscrapr-tests-main")}, # warning = function(e) eval <<- FALSE, # error = function(e) eval <<- FALSE) # # httptest::use_mock_api()
An R Client for Fantasy Football League APIs
Helps access various Fantasy Football APIs (currently MFL, Sleeper, Fleaflicker, and ESPN - perhaps eventually Yahoo and others) by handling authentication/rate-limiting/caching, forming appropriate calls, and returning tidy dataframes which can be easily connected to other data sources.
Install the stable version of this package from CRAN:
install.packages("ffscrapr")
Install the development version from either r-universe or GitHub:
install.packages("ffscrapr", repos = c("https://ffverse.r-universe.dev", getOption("repos"))) # pak is recommended, see https://github.com/r-lib/pak pak::pak("ffverse/ffscrapr") # can also use remotes remotes::install_github("ffverse/ffscrapr")
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.
The best places to get help on this package are:
Many hands make light work! Here are some ways you can contribute to this project:
You can open an issue if you'd like to request specific data or report a bug/error.
You can sponsor this project with donations!
If you'd like to contribute code, please check out the contribution guidelines.
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.
# httptest::stop_mocking() # unlink(c("ffscrapr-tests-1.4.7","f.zip"), recursive = TRUE, force = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.