Any sources of JSON data for live US election results?
from Shdwdrgn@mander.xyz to selfhosted@lemmy.world on 04 Nov 18:16
https://mander.xyz/post/20234005

I’m wondering if anyone has found (free) sources of data to use for live elections results, specifically the Presidential race? I’ve been building a map of poll results but would also like to put something together to watch the race tomorrow night.

#selfhosted

threaded - newest

SnotFlickerman@lemmy.blahaj.zone on 04 Nov 18:21 next collapse

Most election data comes from the Associated Press, but I don’t see a place to purchase API access, may only be available to news orgs.

developer.ap.org/ap-elections-api/

A reddit poster had some JSONs from New York Times four years ago for 2020 but I’m not sure if you can make them work for 2024.

old.reddit.com/r/rstats/comments/…/gmnxfz3/

femtech@midwest.social on 04 Nov 19:54 next collapse

I’ll look around, I haven’t done any work with the AP in years though.

Nope, no access. I’m not sure if their process but I found this.

API Keys

An API key is the access key required for making API calls. If you have not received your API key, please contact AP Customer Support.

Shdwdrgn@mander.xyz on 04 Nov 22:11 collapse

Yeah I found the same on the AP data. I also found that reddit thread, but haven’t been able to find a valid URL for this year’s election. Maybe they don’t make it available until voting starts?

just_another_person@lemmy.world on 04 Nov 18:24 next collapse

Some states have open data. Unsure if it’s in Json though.

muntedcrocodile@lemm.ee on 04 Nov 20:28 next collapse

Take a looj at the websites that have live stats im aure u can dig somthibg out of network tab in the dev tools

Shdwdrgn@mander.xyz on 04 Nov 22:16 collapse

One promising item I found are some json files from Reuters…

This one provides info on the candidates and the key for state ID’s: graphics.thomsonreuters.com/data/…/metadata.json

This one seems like it will provide the ballot counts(0) and possibly any declared winners(1): graphics.thomsonreuters.com/…/president.json

Of course I won’t know anything for sure until tomorrow evening when states start releasing their counts, but I went ahead and wrote up some code to use the files. It’s something at least, and the Reuters data should be fairly timely. I hope to play around with the collected info in real time, then maybe next election I can re-use the same code.

tvcvt@lemmy.ml on 04 Nov 21:02 collapse

In my state (Vermont), the Secretary of State has an rss feed that basically presents the results as an xml file. I’m using that to make some local results spreadsheets. Could be other states have similar things.

Shdwdrgn@mander.xyz on 04 Nov 22:09 collapse

Hmm good idea, I’ll take a look into that!