View Senate
//Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
const url = "https://projects.fivethirtyeight.com/2020-election-forecast/senate_us_latest.json" | |
const req = new Request(url) | |
const res = await req.loadJSON() | |
const classicWinProb = Math.round(res.find(f => f.type == "classic").candidates.find(p => p.candidate == "Democrats").winprob) + "%" | |
const classicWinSeats = res.find(f => f.type == "classic").candidates.find(p => p.candidate == "Democrats").seats.mean.toFixed(1) | |
const liteWinProb = Math.round(res.find(f => f.type == "lite").candidates.find(p => p.candidate == "Democrats").winprob) + "%" |
View Forecast
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
const url = "https://projects.fivethirtyeight.com/2020-election-forecast/us_timeseries.json" | |
const req = new Request(url) | |
const res = await req.loadJSON() | |
const Biden = Math.round(res[0].candidates.find(x => x.candidate == "Biden").dates[0].winprob) + "%" | |
const Trump = Math.round(res[0].candidates.find(x => x.candidate == "Trump").dates[0].winprob) + "%" |