Skip to content

Commit

Permalink
Update tjsp_ler_movimentacao.R
Browse files Browse the repository at this point in the history
  • Loading branch information
jjesusfilho authored Jan 22, 2024
1 parent 976d07a commit 69b7395
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions R/tjsp_ler_movimentacao.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ tjsp_ler_movimentacao <- function (arquivos = NULL, diretorio = ".") {
full.names = TRUE
)
}

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

resposta <- xml2::read_html(.x)

processo <- resposta |>
Expand All @@ -58,11 +58,19 @@ tjsp_ler_movimentacao <- function (arquivos = NULL, diretorio = ".") {
xml2::xml_text(trim = TRUE) |>
lubridate::dmy()

tem_anexo <- movs |>
anexo <- movs |>
xml2::xml_find_first("./td[@class='descricaoMovimentacao']/a") |>
xml2::xml_attr("href") |>
is.na() == FALSE
xml2::xml_attr("href")

cd_documento <- anexo |>
stringr::str_extract("(?<=cdDocumento=)\\d+")


recurso_acessado <- anexo |>
stringr::str_extract("(?<=Acessado=).+") |>
URLdecode() |>
stringr::str_replace_all("\\+", " ")

mov <- movs |>
xml2::xml_find_first("./td[@class='descricaoMovimentacao']") |>
xml2::xml_text(trim=TRUE)
Expand All @@ -72,7 +80,8 @@ tjsp_ler_movimentacao <- function (arquivos = NULL, diretorio = ".") {
cd_processo,
dt_mov,
mov,
tem_anexo
cd_documento,
recurso_acessado
) |>
tidyr::separate(
col = mov,
Expand Down

0 comments on commit 69b7395

Please sign in to comment.