R/bndr_extrair_sobrestados.R

Defines functions bndr_extrair_sobrestados

Documented in bndr_extrair_sobrestados

#' Extrair processos sobrestados
#'
#' @param id Id do incidente
#'
#' @return tibble
#' @export
#'
bndr_extrair_sobrestados <- function(id){

  pb <- progress::progress_bar$new(total = length(id))

  uri <- "https://www.cnj.jus.br/bnpr-web/rest/precedentes/download/"


  purrr::map_dfr(id, purrr::possibly(~{

    pb$tick()

    url <- paste0(uri,.x,"/SOBRESTADO")

    sobrestados <- readLines(url)

    tibble::tibble(id = .x, sobrestado = sobrestados)


  },NULL))

}
jjesusfilho/bndr documentation built on Jan. 1, 2021, 5:32 a.m.