4
I’m trying to make the Scrape of the Ministry of Labor mediating system. Basically, I want the relationship of collective agreements and conventions:
url1<-"http://www3.mte.gov.br/sistemas/mediador/ConsultarInstColetivo"
Once I access this page, I arrive at the search form. I chose only to select the term: "All" and the registration UF: "IF"
By clicking, I have access to XHR:
url2<-"http://www3.mte.gov.br/sistemas/mediador/ConsultarInstColetivo/getConsultaAvancada"
And the body:
str(body)
List of 27
$ nrCnpj : chr ""
$ nrCei : chr ""
$ noRazaoSocial : chr ""
$ dsCategoria : chr ""
$ tpRequerimento : chr "acordo"
$ tpRequerimento : chr "acordoColetivoEspecificoPPE"
$ tpRequerimento : chr "acordoColetivoEspecificoDomingosFeriados"
$ tpRequerimento : chr "convencao"
$ tpRequerimento : chr "termoAditivoAcordo"
$ tpRequerimento : chr "termoAditivoConvecao"
$ tpRequerimento : chr "termoAditivoAcordoEspecificoPPE"
$ tpRequerimento : chr "termoAditivoAcordoEspecificoDomingoFeriado"
$ tpVigencia : chr "2"
$ sgUfDeRegistro : chr "SE"
$ dtInicioRegistro : chr ""
$ dtFimRegistro : chr ""
$ dtInicioVigenciaInstrumentoColetivo: chr ""
$ dtFimVigenciaInstrumentoColetivo : chr ""
$ tpAbrangencia : chr "Todos os tipos"
$ ufsAbrangidasTotalmente : chr "SE"
$ cdMunicipiosAbrangidos : chr ""
$ cdGrupo : chr ""
$ cdSubGrupo : chr ""
$ noTituloClausula : chr ""
$ utilizarSiracc : chr ""
$ pagina : chr "2"
$ qtdTotalRegistro : chr "1740"
Then I did the following to access the results:
library(httr)
a<-GET(url1)
b<-POST(url2,body=body,set_cookies(unlist(a$cookies)))
But unfortunately the answer does not return the expected results.
Note that
url2
does not work... For it to work properly you need to access the filters fromurl1
– TheBiro
I tried with url1. I thought that if I include the url1 request cookie in the url2 request, the problem is solved, but I was unsuccessful.
– José