Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#' 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