-
Notifications
You must be signed in to change notification settings - Fork 0
/
fl_pres.js
executable file
·33 lines (30 loc) · 1.08 KB
/
fl_pres.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pjs.config({
// options: 'stdout', 'file' (set in config.logFile) or 'none'
log: 'stdout',
// options: 'json' or 'csv'
format: 'json',
// options: 'stdout' or 'file' (set in config.outFile)
writer: 'file',
outFile: 'fl_pres.json'
});
pjs.addSuite({
url: 'http://enight.dos.state.fl.us/FederalOffices/President/'
,scraper: function(){
var tbl = $('.grid-table').map(function() {
return $(this).find('td').map(function() {
return $(this).text();
}).get();
}).get();
tbl.splice(74);
var results2 = {};
for (i = 0; i < tbl.length / 4; i++){
var s = i*4;
results2[tbl[s]] = {};
results2[tbl[s]]['votes'] = tbl[s+2];
results2[tbl[s]]['percent'] = tbl[s+3];
}
results2['reporting'] = 'Unknown % Precincts Reporting'
results2['election'] = 'FL President';
return results2
}
});