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
library(magrittr) | |
#url | |
u <- 'http://pesquisajuris.tjdft.jus.br/IndexadorAcordaos-web/sistj?visaoId=tjdf.sistj.acordaoeletronico.buscaindexada.apresentacao.VisaoBuscaAcordao&controladorId=tjdf.sistj.acordaoeletronico.buscaindexada.apresentacao.ControladorBuscaAcordao&visaoAnterior=tjdf.sistj.acordaoeletronico.buscaindexada.apresentacao.VisaoBuscaAcordao&nomeDaPagina=resultado&comando=abrirDadosDoAcordao&enderecoDoServlet=sistj&historicoDePaginas=buscaLivre&quantidadeDeRegistros=20&baseSelecionada=BASE_ACORDAO_TODAS&numeroDaUltimaPagina=1&buscaIndexada=1&mostrarPaginaSelecaoTipoResultado=false&totalHits=1&internet=1&numeroDoDocumento=1005250' | |
# usei html session pra economizar codigo de escrever o form inteiro | |
s <- rvest::html_session(u) | |
form <- rvest::html_form(s)[[1]] %>% | |
rvest::set_values(comando = 'downloadInteiroTeor') | |
s <- rvest::submit_form(s, form) |
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
library(RCurl) | |
library(XML) | |
library(stringi) | |
mediador_meta<-function(livre="",uf="",cnpj=""){ | |
url1<-"http://www3.mte.gov.br/sistemas/mediador/ConsultarInstColetivo" | |
url2 <- "http://www3.mte.gov.br/sistemas/mediador/ConsultarInstColetivo/getConsultaAvancada" | |
## Cria a handle, configura as opções do request e realiza o primeiro request, salvando os cookies para posteriores requests. | |
curl = getCurlHandle() |
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
library(RCurl) | |
library(XML) | |
library(stringi) | |
mediador_inteiro_teor<-function(solicitacao,download=TRUE,vector=TRUE){ | |
url<-paste0("http://www3.mte.gov.br/sistemas/mediador/Resumo/ResumoVisualizar?NrSolicitacao=",solicitacao) | |
## Cria um objeto a parte para usá-lo a fim de nomear os arquivos a serem baixados | |
s<-as.character(solicitacao) |
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
number_br<-function(str){ | |
str<-stringr::str_replace_all(str,"\\.","") | |
str<-stringr::str_replace_all(str,",",".") | |
str<-stringr::str_trim(str) | |
num<-as.numeric(str) | |
return(num) | |
} |
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
structure(list(dados.buscaInteiroTeor = "feminista", dados.pesquisarComSinonimos = "S", | |
dados.pesquisarComSinonimos = "S", dados.buscaEmenta = "", | |
dados.nuProcOrigem = "", dados.nuRegistro = "", agenteSelectedEntitiesList = "", | |
contadoragente = "0", contadorMaioragente = "0", codigoCr = "", | |
codigoTr = "", nmAgente = "", juizProlatorSelectedEntitiesList = "", | |
contadorjuizProlator = "0", contadorMaiorjuizProlator = "0", | |
codigoJuizCr = "", codigoJuizTr = "", nmJuiz = "", classesTreeSelection.values = "", | |
classesTreeSelection.text = "", assuntosTreeSelection.values = "", | |
assuntosTreeSelection.text = "", comarcaSelectedEntitiesList = "", | |
contadorcomarca = "0", contadorMaiorcomarca = "0", cdComarca = "", |
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
function(url) { | |
arq_img<-"amor.png" | |
arq_aud<-"amor_mpg" | |
folder_img <- dirname(arq_img) | |
folder_aud <- dirname(arq_aud) | |
httr::handle_reset('https://esaj.tjsp.jus.br/cjsg') | |
u0<-url | |
r0 <- httr::GET(u0) | |
u_aud <- 'https://esaj.tjsp.jus.br/cjsg/somCaptcha.do' | |
u_img <- 'https://esaj.tjsp.jus.br/cjsg/imagemCaptcha.do' |
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
## Acidentes de trabalho | |
library(tidyverse) | |
library(jsonlite) | |
url<-"http://dadosabertos.dataprev.gov.br/opendata/act10/formato=json" | |
a<-readLines(file(url, encoding="ISO-8859-1"), warn=FALSE) | |
b<-fromJSON(a) | |
c<-b$nodes$node | |
c<-c[str_which(c$CNAE,"^(20|21)"),] | |
c[]<-lapply(c,function(x) iconv(x,from="latin2",to="UTF-8")) |
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
library(stringr) | |
library(magritr) | |
query_extract<-function(string){ | |
s<-str_split(string,"&") %>% | |
unlist() | |
nomes<-s %>% | |
str_extract(".*?(?=\\=)") |
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
ifs<-function(x,y,z=NULL){ | |
stopifnot(is.list(y)) | |
#if(length(z)==0) {z<-x} | |
for(i in 1:length(y)){ | |
x<-ifelse(stringr::str_detect(x,y[[i]][1]),y[[i]][2],x) | |
} | |
return(x) | |
} |
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
library(httr) | |
library(xml2) | |
library(stringr) | |
library(boilerpipeR) | |
tjrsSG_meta<-function(BuscaLivre="",quote=TRUE){ | |
if(quote==TRUE) BuscaLivre<-deparse(BuscaLivre) | |
url<-"http://www.tjrs.jus.br/busca/search?" |
OlderNewer