Created
August 28, 2020 23:03
-
-
Save jtrecenti/c7188dd43d0bdf0208b168b03d7e6894 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Author: | |
#' Subject: | |
# library(tidyverse) | |
library(magrittr) | |
# Import ----------------------------------------------------------------------- | |
library(magrittr) | |
# criterio de consulta | |
bd <- list( | |
COD_MTRA_LEGL = "", | |
FILTRO_COD_PCSS_CMSP_INI = "", | |
FILTRO_ANO_PCSS_CMSP_INI = "", | |
FILTRO_COD_PCSS_CMSP_FIM = "", | |
FILTRO_ANO_PCSS_CMSP_FIM = "", | |
LDRE_COD = "=", | |
LDRE_NRO = "", | |
LDRE_ANO = "", | |
DT_LEIT_INI = "01/08/2020", | |
DT_LEIT_FIM = "31/08/2020", | |
TRAMIT_ONLY = "false", | |
PROMUL_ONLY = "false", | |
COD_TIPO_MOTIVO_TRAMITACAO = "", | |
TXT_OBSERVACAO_TRAMITACAO = "", | |
COD_TIPO_VETO = "", | |
VOTACAO = "" | |
) | |
# consulta inicial | |
u <- "https://splegisconsulta.camara.sp.gov.br/Pesquisa/IndexProjeto" | |
r <- httr::POST(u, body = bd, httr::write_disk("res_inicial.html")) | |
# scrapr::html_view(r) | |
# (nao fiz) script para achar numero de paginas | |
# ... | |
# loopar nas paginas | |
pag <- 1 | |
q_pagina <- list( | |
"currentPage" = pag, | |
"pageSize" = 10, | |
"pageRowSize" = 20 | |
) | |
f <- sprintf("%02d.html", pag) | |
r_pagina <- httr::GET(u, query = q_pagina, httr::write_disk(f, TRUE)) | |
# scrapr::html_view(r_pagina) | |
# Tidy ------------------------------------------------------------------------- | |
# Visualize -------------------------------------------------------------------- | |
# Model ------------------------------------------------------------------------ | |
# Export ----------------------------------------------------------------------- | |
# readr::write_rds(d, "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment