Skip to content

Commit

Permalink
v2.2.0 (#13)
Browse files Browse the repository at this point in the history
* chore: deps updated

* chore: cheerio actualizado

* feat: scraping de todas las columnas de cupos

* chore: updated tests

* chore: updated deps

* fix: rollback to node-fetch ^2
  • Loading branch information
aurmeneta authored Jan 6, 2024
1 parent 454480d commit 5de6136
Show file tree
Hide file tree
Showing 5 changed files with 5,439 additions and 2,593 deletions.
22 changes: 21 additions & 1 deletion lib/cupos/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ async function obtenerCupos (periodo, nrc, urlCupos = URLS.cupos, urlBuscaCursos
vacantesDisponibles: curso.vacantes_disponibles,
cupos: [{
escuela: 'Vacantes Libres',
nivel: '',
programa: '',
concentracion: '',
cohorte: '',
admision: '',
vacantesOfrecidas: curso.vacantes_totales,
vacantesOcupadas: curso.vacantes_totales - curso.vacantes_disponibles,
vacantesDisponibles: curso.vacantes_disponibles
Expand All @@ -57,11 +62,26 @@ async function obtenerCupos (periodo, nrc, urlCupos = URLS.cupos, urlBuscaCursos
const columnas = $(fila).find('td')

const escuela = $(columnas[0]).text().trim()
const nivel = $(columnas[1]).text().trim()
const programa = $(columnas[2]).text().trim()
const concentracion = $(columnas[3]).text().trim()
const cohorte = $(columnas[4]).text().trim()
const admision = $(columnas[5]).text().trim()
const vacantesOfrecidas = parseInt($(columnas[6]).text())
const vacantesOcupadas = parseInt($(columnas[7]).text())
const vacantesDisponibles = parseInt($(columnas[8]).text())

cupos.push({ escuela, vacantesOfrecidas, vacantesOcupadas, vacantesDisponibles })
cupos.push({
escuela,
nivel,
programa,
concentracion,
cohorte,
admision,
vacantesOfrecidas,
vacantesOcupadas,
vacantesDisponibles
})
})

const curso = {
Expand Down
Loading

0 comments on commit 5de6136

Please sign in to comment.