This file contains hidden or 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 hidden or 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) | |
| ### Função para converter o form em lista | |
| post_form<-function(form){ | |
| form<-stringr::str_split(form,"\n") | |
| form<-unlist(form) | |
| nomes<-stringi::stri_extract_first_regex(form,".*(?=:)",omit_no_match=F) | |
| valores<-stringi::stri_extract_first_regex(form,"(?<=:).*",omit_no_match=F) | |
| nomes<-as.list(nomes) |
This file contains hidden or 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(tjsp) | |
| library(tidyverse) | |
| library(stringr) | |
| ### Baixar dados de primeiro grau | |
| ### Fazer a busca na página do TJ: julgados de primeiro grau, copiar a url e colá-la aqui. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| tjrjSG_meta<-function(BuscaLivre,quoted=TRUE){ | |
| if(quoted==TRUE){ | |
| BuscaLivre<-BuscaLivre %>% | |
| str_replace_all("\\s+","+") %>% | |
| deparse() | |
| } | |
| url<-"http://www.tjrj.jus.br/search?site=juris&client=juris&output=xml_no_dtd&proxystylesheet=juris" |
This file contains hidden or 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
| ## Extrai os dados da rais com base na UF, no CNAE 2.0, no CBO e no Ano. | |
| ## O único argumento necessário é o ano. No entanto, a menos que sua memória ram tenha ao menos | |
| rais<-function(uf=NULL,CNAE="",CBO="",ano=NULL){ | |
| stopifnot(length(ano)==1,is.numeric(ano)) | |
| u<-paste0("ftp://ftp.mtps.gov.br/pdet/microdados/RAIS/",ano,"/") | |
| h <- curl::new_handle(dirlistonly=TRUE) | |
| con <- curl::curl(u, "r", h) | |
| tbl <- read.table(con, stringsAsFactors=FALSE, fill=TRUE) | |
| close(con) |
OlderNewer