Un programa para extraer todos los datos públicos del registro electoral de Puerto Rico, accesibles a través de https://consulta.ceepur.org/
Project description
ceepur-scraper
Un programa para extraer todos los datos públicos del registro electoral de Puerto Rico, accesibles a través de https://consulta.ceepur.org/.
El programa toma alrededor de 5 horas para bajar todos los datos posibles.
pip install ceepur-scraper
Uso
Para correr el scraper, simplemente ejecute lo siguiente en tu terminal luego de instalar el paquete:
ceepur-scraper
Utiliza la opción --help para ver todas las opciones disponibles:
$ ceepur-scraper --help
usage: ceepur-scraper [-h] [--output OUTPUT_FILENAME] [--max-id MAX_ID] [--min-id MIN_ID]
[--reverse] [--max-concurrent-tasks MAX_CONCURRENT_TASKS]
[--continue-previous-scrape] [--save-descriptions] [--debug]
optional arguments:
-h, --help show this help message and exit
--output OUTPUT_FILENAME, -o OUTPUT_FILENAME
The filename to write the scraped voter records to. Defaults to
voter_records.csv.
--max-id MAX_ID The maximum voter ID to scrape. Cannot be greater than 9,999,999.
--min-id MIN_ID The minimum voter ID to scrape. Cannot be less than 1.
--reverse Whether to scrape in reverse order.
--max-concurrent-tasks MAX_CONCURRENT_TASKS
The maximum number of concurrent tasks to run. Defaults to 500.
--continue-previous-scrape, -c
Whether to continue a previous scrape that was interrupted.
--save-descriptions Whether to save the descriptions of the voter's status and category. ⚠️
WARNING: This will significantly increase the size of the output file.
--debug, -d Run in debug mode.
Esto producirá un archivo llamado voter_records.csv en el directorio actual que se parecerá a esta tabla:
NumeroElectoral |
Category |
FechaNacimiento |
Precinto |
Status |
Unidad |
|---|---|---|---|---|---|
4980113 |
M |
22-10-1926 |
1 |
E |
2 |
Descripción de Category y Status
El campo Category es un solo carácter. Su significado depende del valor de Status.
Expanda la siguiente sección para ver el significado de cada categoría:
Haz click para expandir...
El Status de un elector puede ser:
A: ActivoI: InactivoE: Excluido
El campo Category da más información acerca del Status de un elector:
- Para electores con status
A, el campoCategorypuede ser:1:VOTÓ EN NOVIEMBRE DE 20202:NO VOTÓ EN NOVIEMBRE DE 20203:INGRESÓ POR MEDIO DE NUEVA INSCRIPCIÓN4:INGRESO POR MEDIO DE INSCRIPCIÓN ESPECIAL (Reactivación)5:INGRESO POR MEDIO DE INCLUSIÓN (Administrativa)
- Para electores con status
I, el campoCategorypuede ser:1:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES DE 19802:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES DE 19843:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES DE 19884:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES DE 19925:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES DE 19966:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES 20007:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES 20048:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES 20089:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES 2012A:INACTIVO EN LA DEPURACIÓN DE LISTAS POSTERIOR A LAS ELECCIONES GENERALES 2020
- Para electores con status
E, el campoCategorypuede ser:A:EXCLUSIÓN ADMINISTRATIVAC:NO ES CIUDADANO AMERICANOD:DUPLICADOE:NO TIENE 18 AÑOS DE EDADM:MUERTEP:NO ES PERSONA EN PETICIÓNR:NO ES RESIDENTE DEL PRECINTOT:INCAPACITADO MENTAL
También puedes correr el scraper con la opción --save-descriptions para guardar una descripción de cada categoría en el archivo final (⚠️ ¡Esto aumentará el tamaño del archivo significativamente!).
¿Qué hacer si hay un error?
Puedes intentar de recorrer un "scrape" con la opción --continue-previous-scrape (o -c) para intentar continuar el scrape desde donde se quedó.
Si todavía hay fallos, usa la opción --debug (o -d) para ver el error completo. Si no sabes como resolverlo, abre un issue en este repositorio.
Ejemplo
# Descargar electores 1-100 y guardar en "resultados.csv", incluyendo descripciones de categorías
ceepur-scraper --output resultados.csv --min-id 1 --max-id 100 --save-descriptions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ceepur_scraper-0.1.1.tar.gz.
File metadata
- Download URL: ceepur_scraper-0.1.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.1 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d125950ed9282ed2a1bddf7daa20f48adbbce6a83029c5257cc3a96e213ce5dc
|
|
| MD5 |
8f32bd5ecd56bacec36a70bdd5a5e67a
|
|
| BLAKE2b-256 |
91442a734d425a1082e40e9388e600bcb67dd87d7d59f7c11b06a923c40d429c
|
File details
Details for the file ceepur_scraper-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ceepur_scraper-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.1 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea4b4fc1f06fe59d6c55b7ef7e7240258654cf334cf510e7835aad6ffb26552f
|
|
| MD5 |
0c1cfb595a0371063bbb6363592542a3
|
|
| BLAKE2b-256 |
37034b7083cbb5a651dc473110890bf419c1c46b9cca117fb683180b96497f22
|