nflverse-rosters icon indicating copy to clipboard operation
nflverse-rosters copied to clipboard

pff ID code

Open tanho63 opened this issue 1 year ago • 0 comments

library(dplyr)
library(purrr)
library(jsonlite)

pff_cfb <- expand.grid(
  season = 2016:2022,
  position = c('QB', 'WR', 'HB', 'FB', 'TE', 'C', 'G', 'T', 'CB', 'S', 'LB', 'DI', 'ED', 'K', 'P')
)  |> 
  dplyr::mutate(
    url = paste0('https://www.pff.com/api/nfl/grades?league=ncaa&position=',
                 position, "&season=", season),
    season = NULL,
    position = NULL
  )  |> 
  dplyr::pull()  |> 
  list()  |> 
  purrr::pmap_dfr(function(x) {
    jsonlite::fromJSON(x)  |> 
      purrr::pluck("players")
  })

pff_nfl <- expand.grid(
  season = 2018:2022,
  position = c('QB', 'WR', 'HB', 'FB', 'TE', 'C', 'G', 'T', 'CB', 'S', 'LB', 'DI', 'ED', 'K', 'P')
)  |> 
  dplyr::mutate(
    url = paste0('https://www.pff.com/api/nfl/grades?league=nfl&position=',
                 position, "&season=", season),
    season = NULL,
    position = NULL
  )  |> 
  dplyr::pull()  |> 
  list()  |> 
  purrr::pmap_dfr(function(x) {
    jsonlite::fromJSON(x)  |> 
      purrr::pluck("players")
  }

tanho63 avatar Feb 16 '23 02:02 tanho63