Skip to content

Instantly share code, notes, and snippets.

@diegovalle
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegovalle/c1db82e8f977a78a2beb to your computer and use it in GitHub Desktop.
Save diegovalle/c1db82e8f977a78a2beb to your computer and use it in GitHub Desktop.
Download the complete RNPED (https://rnped.segob.gob.mx/)
library("jsonlite")
library("dplyr")
library("magrittr")
library("stringr")
rnpe_c <- fromJSON('rnped_comun.json')
rnpe_c <- as.data.frame(rnpe_c$aaData, stringsAsFactors = FALSE)
rnpe_c$date <- as.Date(rnpe_c$fuerocomun_desapfecha, "%d/%m/%Y")
rnpe_c$tipo <- "comun"
rnpe_c$fuerocomun_desapentidad %<>% str_replace_all(" DE ZARAGOZA|ESTADO DE ", "")
write.csv(rnpe_c, "rnped_comun.csv", row.names=FALSE)
rnpe_f <- fromJSON('rnped_federal.json')
rnpe_f <- as.data.frame(rnpe_f$aaData, stringsAsFactors = FALSE)
rnpe_f <- rnpe_f %>%
mutate(fuerofederal_ultimapais = iconv(fuerofederal_ultimapais, to="ASCII//TRANSLIT"),
fuerofederal_ultimaentidad = iconv(fuerofederal_ultimaentidad, to="ASCII//TRANSLIT"),
fuerofederal_ultimampio = iconv(fuerofederal_ultimampio, to="ASCII//TRANSLIT"))
rnpe_f$date <- as.Date(rnpe_f$fuerofederal_ultimafecha, "%d/%m/%Y")
rnpe_f$tipo <- "federal"
write.csv(rnpe_f, "rnped_federal.csv", row.names=FALSE)
curl 'https://rnped.segob.gob.mx/inicio/busqueda/federal' -H 'Cookie: rnped_sesion=UWRfYQg%2FBmkBLAN2VmcCOQFpVyMPewdmWilXbAQ5VjhVX1UzU2QHIgNsUCcAOwhuUjZQbAQtATABYwZgATEAMFo7VTAEN1AzVzZTPQAyVWJRZF8%2FCD4GYwFlA2RWbgJlAWNXYA89BzNabFdgBG5WblU5VWJTMgciA2xQJwA7CGRSPlB0BHwBZgEgBjkBaQBqWgVVbgQmUHJXOVMvAGlVY1ExX2EIKwZiAW8DMlZzAjIBYFc1DyYHMlpiVzYEeFZuVTJVeFM7B3MDbVBlADcIZ1ImUCUEagFwAToGPwFoAFtaL1V0BDNQIldjUzsANlU8UXFfeQgyBiABbQM0Vm0CMwFpVyMPRQdsWiBXbAQ6VjpVYVV1UzUHLgNnUHQAKQgFUjVQZwQ0ASMBHwY5AWgAcVoiVScEP1BmVzpTagB6VXJRRF8rCHkGPwEyA1JWOAJiARhXaA98Byxab1c2BGFWeFUzVWxTIAcoAxxQHABVCBBSSFB6BC8BbwE6BjsBYwAkWh1VYgQ1UDtXbVN1AHNVEVFtXykIZgY%2BATIDKlZpAjEBfVcxDyYHMVpoVzIEZFZ4VTFValMxByADBFA1AGcIPFJ2UD8EIAE2AWAGZwEoADdabFUlBG1QI1c4U20AalVoUSdfKAhsBiABPgNqVjMCXwE%2FV2APewd3WjtXZgQiVj9VdlUzU3QHeQN1UG8AaAhnUjVQYgQ9ATQBYwZnATEAMFprVTQEbVAjVzhTbQBmVWhRJ18oCGwGIAE%2BA2pWMwJfAT1Xbg99B3NaPldkBCJWM1UiVWFTaQc6A2dQbwByCGdSNVBjBDUBIQEgBjUBdQBtWjVVaQQJUCVXcVM5ACFVNlFkXy8IaAZxAWwDdlZnAjABaVcjDyoHOFon' -H 'Origin: https://rnped.segob.gob.mx' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,es-419;q=0.6,es;q=0.4,fr;q=0.2' -H 'User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://rnped.segob.gob.mx/' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'DNT: 1' --data 'sEcho=7&iColumns=14&sColumns=%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C&iDisplayStart=0&iDisplayLength=100000&mDataProp_0=fuerofederal_ultimafecha&sSearch_0=&bRegex_0=false&bSearchable_0=true&bSortable_0=true&mDataProp_1=fuerofederal_ultimapais&sSearch_1=&bRegex_1=false&bSearchable_1=true&bSortable_1=true&mDataProp_2=fuerofederal_ultimaentidad&sSearch_2=&bRegex_2=false&bSearchable_2=true&bSortable_2=true&mDataProp_3=fuerofederal_ultimaentidadcve&sSearch_3=&bRegex_3=false&bSearchable_3=true&bSortable_3=true&mDataProp_4=fuerofederal_ultimampio&sSearch_4=&bRegex_4=false&bSearchable_4=true&bSortable_4=true&mDataProp_5=fuerofederal_ultimampiocve&sSearch_5=&bRegex_5=false&bSearchable_5=true&bSortable_5=true&mDataProp_6=fuerofederal_paisnac&sSearch_6=&bRegex_6=false&bSearchable_6=true&bSortable_6=true&mDataProp_7=fuerofederal_nacionalidad&sSearch_7=&bRegex_7=false&bSearchable_7=true&bSortable_7=true&mDataProp_8=fuerofederal_sexo&sSearch_8=&bRegex_8=false&bSearchable_8=true&bSortable_8=true&mDataProp_9=fuerofederal_edad&sSearch_9=&bRegex_9=false&bSearchable_9=true&bSortable_9=true&mDataProp_10=fuerofederal_tipolugar&sSearch_10=&bRegex_10=false&bSearchable_10=true&bSortable_10=true&mDataProp_11=fuerofederal_autoridad&sSearch_11=&bRegex_11=false&bSearchable_11=true&bSortable_11=true&mDataProp_12=fuerofederal_fechadenuncia&sSearch_12=&bRegex_12=false&bSearchable_12=true&bSortable_12=true&mDataProp_13=fuerofederal_entidad&sSearch_13=&bRegex_13=false&bSearchable_13=true&bSortable_13=true&sSearch=&bRegex=false&iSortCol_0=0&sSortDir_0=desc&iSortingCols=1&c_nombre=&c_apaterno=&c_amaterno=&c_sexo=&c_edadmin=0&c_edadmax=120&c_entidad=' --compressed > rnped_federal.json
curl 'https://rnped.segob.gob.mx/inicio/busqueda/comun' -H 'Cookie: rnped_sesion=UWRfYQg%2FBmkBLAN2VmcCOQFpVyMPewdmWilXbAQ5VjhVX1UzU2QHIgNsUCcAOwhuUjZQbAQtATABYwZgATEAMFo7VTAEN1AzVzZTPQAyVWJRZF8%2FCD4GYwFlA2RWbgJlAWNXYA89BzNabFdgBG5WblU5VWJTMgciA2xQJwA7CGRSPlB0BHwBZgEgBjkBaQBqWgVVbgQmUHJXOVMvAGlVY1ExX2EIKwZiAW8DMlZzAjIBYFc1DyYHMlpiVzYEeFZuVTJVeFM7B3MDbVBlADcIZ1ImUCUEagFwAToGPwFoAFtaL1V0BDNQIldjUzsANlU8UXFfeQgyBiABbQM0Vm0CMwFpVyMPRQdsWiBXbAQ6VjpVYVV1UzUHLgNnUHQAKQgFUjVQZwQ0ASMBHwY5AWgAcVoiVScEP1BmVzpTagB6VXJRRF8rCHkGPwEyA1JWOAJiARhXaA98Byxab1c2BGFWeFUzVWxTIAcoAxxQHABVCBBSSFB6BC8BbwE6BjsBYwAkWh1VYgQ1UDtXbVN1AHNVEVFtXykIZgY%2BATIDKlZpAjEBfVcxDyYHMVpoVzIEZFZ4VTFValMxByADBFA1AGcIPFJ2UD8EIAE2AWAGZwEoADdabFUlBG1QI1c4U20AalVoUSdfKAhsBiABPgNqVjMCXwE%2FV2APewd3WjtXZgQiVj9VdlUzU3QHeQN1UG8AaAhnUjVQYgQ9ATQBYwZnATEAMFprVTQEbVAjVzhTbQBmVWhRJ18oCGwGIAE%2BA2pWMwJfAT1Xbg99B3NaPldkBCJWM1UiVWFTaQc6A2dQbwByCGdSNVBjBDUBIQEgBjUBdQBtWjVVaQQJUCVXcVM5ACFVNlFkXy8IaAZxAWwDdlZnAjABaVcjDyoHOFon' -H 'Origin: https://rnped.segob.gob.mx' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,es-419;q=0.6,es;q=0.4,fr;q=0.2' -H 'User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://rnped.segob.gob.mx/' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'DNT: 1' --data 'sEcho=8&iColumns=15&sColumns=%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C&iDisplayStart=0&iDisplayLength=100000&mDataProp_0=fuerocomun_desapfecha&sSearch_0=&bRegex_0=false&bSearchable_0=true&bSortable_0=true&mDataProp_1=fuerocomun_desaphora&sSearch_1=&bRegex_1=false&bSearchable_1=true&bSortable_1=true&mDataProp_2=fuerocomun_desappais&sSearch_2=&bRegex_2=false&bSearchable_2=true&bSortable_2=true&mDataProp_3=fuerocomun_desapentidad&sSearch_3=&bRegex_3=false&bSearchable_3=true&bSortable_3=true&mDataProp_4=fuerocomun_desapmunicipio&sSearch_4=&bRegex_4=false&bSearchable_4=true&bSortable_4=true&mDataProp_5=fuerocomun_desaplocalidad&sSearch_5=&bRegex_5=false&bSearchable_5=true&bSortable_5=true&mDataProp_6=fuerocomun_nacionalidad&sSearch_6=&bRegex_6=false&bSearchable_6=true&bSortable_6=true&mDataProp_7=fuerocomun_estatura&sSearch_7=&bRegex_7=false&bSearchable_7=true&bSortable_7=true&mDataProp_8=fuerocomun_complexion&sSearch_8=&bRegex_8=false&bSearchable_8=true&bSortable_8=true&mDataProp_9=fuerocomun_sexo&sSearch_9=&bRegex_9=false&bSearchable_9=true&bSortable_9=true&mDataProp_10=fuerocomun_edad&sSearch_10=&bRegex_10=false&bSearchable_10=true&bSortable_10=true&mDataProp_11=fuerocomun_descripcion&sSearch_11=&bRegex_11=false&bSearchable_11=true&bSortable_11=true&mDataProp_12=fuerocomun_etnia&sSearch_12=&bRegex_12=false&bSearchable_12=true&bSortable_12=true&mDataProp_13=fuerocomun_discapacidad&sSearch_13=&bRegex_13=false&bSearchable_13=true&bSortable_13=true&mDataProp_14=fuerocomun_dependencia&sSearch_14=&bRegex_14=false&bSearchable_14=true&bSortable_14=true&sSearch=&bRegex=false&iSortCol_0=0&sSortDir_0=asc&iSortingCols=1&c_nombre=&c_apaterno=&c_amaterno=&c_sexo=&c_edadmin=0&c_edadmax=150&c_entidad=' --compressed > rnped_comun.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment