Skip to content

Instantly share code, notes, and snippets.

@jjesusfilho
Created May 4, 2017 09:31
Show Gist options
  • Save jjesusfilho/34beb8b2f761b74e729f8fb794081173 to your computer and use it in GitHub Desktop.
Save jjesusfilho/34beb8b2f761b74e729f8fb794081173 to your computer and use it in GitHub Desktop.
testar_processo
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'
httr::GET(u_img, httr::write_disk(arq_img, overwrite = TRUE))
httr::GET(u_aud, httr::write_disk(arq_aud, overwrite = TRUE))
res <- captchaSajAudio::decifrar(arq_aud)
u1 <- paste0(u0, '&vlCaptcha=', res)
r1 <- httr::GET(u1)$all_headers[[1]]$headers[['content-type']]
passou <- r1 == "application/pdf;charset=UTF-8"
return(c(passou, res))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment