-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f0736da
Showing
5 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Folders | ||
node_modules | ||
.vscode | ||
.DS_Store | ||
logs | ||
|
||
# Files | ||
.env | ||
*.log | ||
*.DS_Store | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const axios = require('axios') | ||
const cheerio = require('axios') | ||
const fs = require('fs') | ||
const officeHolders = require('./office-holders') | ||
|
||
const START_DATE = '06-18-1996' | ||
const END_DATE = '08-25-2019' | ||
|
||
const genURL = officeHolder => `https://www.miamidade.gov/govaction/Votingrecord.asp?` + | ||
`begdate=${START_DATE}&` + | ||
`enddate=${END_DATE}&` + | ||
`OfficeHolders=${officeHolders[officeHolder]}&` + | ||
`MatterType=AllMatters&` + | ||
`BodyType=AllBodies` + | ||
`&submit1=Submit` | ||
|
||
const allObjs = document.querySelectorAll('tr[valign="top"]') | ||
const combinedRecords = (() => { | ||
let cr = [] | ||
for (let i = 0; i < allObjs.length; i += 1) { | ||
var currentObj = allObjs[i] | ||
switch (i % 3) { | ||
case 0: // 1st line | ||
cr.push([currentObj]); break | ||
case 1: | ||
case 2: | ||
cr[cr.length - 1].push(currentObj); break | ||
} | ||
} | ||
return cr | ||
})() | ||
|
||
const resolutions = (() => { | ||
const r = {} | ||
combinedRecords.forEach(a => { | ||
var id = Number(Array.from(a[0].querySelectorAll('b'))[0].innerText) | ||
var name = String(Array.from(a[0].querySelectorAll('b'))[1].innerText) | ||
var type = String(Array.from(a[0].querySelectorAll('b'))[2].innerText) | ||
var description = String(Array.from(a[1].querySelectorAll('b'))[1].innerText) | ||
var resolutionFull = String(Array.from(a[2].querySelectorAll('b'))[1].innerText) | ||
var date = resolutionFull.match(/([0-9]){1,2}\/([0-9]){1,2}\/([0-9]){4}/g)[0] | ||
var resolution = resolutionFull.split(date)[1] | ||
r[id] = { | ||
id, name, type, description, date, resolution | ||
} | ||
}) | ||
return r | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const officeHolders = { | ||
54: 'Betty T. Ferguson', | ||
55: 'James Burke', | ||
56: 'Arthur E. Teele, Jr.', | ||
57: 'Gwen Margolis', | ||
58: 'Bruce C. Kaplan', | ||
59: 'Pedro Reboredo', | ||
60: 'Maurice A. Ferre', | ||
61: 'Katy Sorenson', | ||
62: 'Dennis C. Moss', | ||
64: 'Miguel Diaz de la Portilla', | ||
65: 'Alexander Penelas', | ||
249: 'Dr. Miriam Alonso', | ||
251: 'Jimmy L. Morales', | ||
352: 'Bruno A. Barreiro', | ||
427: 'Natacha Seijas', | ||
431: 'Joe A. Martinez', | ||
455: 'Rebeca Sosa', | ||
476: 'Dr. Barbara Carey-Shuler', | ||
486: 'Sen. Javier D. Souto', | ||
495: 'Jose "Pepe" Cancio, Sr.', | ||
505: 'Jose "Pepe" Diaz', | ||
506: 'Sally A. Heyman', | ||
507: 'Dorrin Rolle', | ||
554: 'Carlos A. Gimenez', | ||
555: 'Barbara J. Jordan', | ||
571: 'Audrey M. Edmonson', | ||
625: 'Lynda Bell', | ||
626: 'Jean Monestime', | ||
641: 'Esteban L. Bovo, Jr.', | ||
642: 'Xavier L. Suarez', | ||
663: 'Juan C. Zapata', | ||
676: 'Daniella Levine Cava', | ||
699: 'Eileen Higgins' | ||
} | ||
|
||
module.exports = officeHolders |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "voting-scraper", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"axios": "^0.19.0", | ||
"cheerio": "^1.0.0-rc.3" | ||
} | ||
} |