3 ms·
Associated Press offers a data feed http://ap.org/products-services/elections/FAQs http://ap.org/products-services/elections/FAQs https://developer.ap.org/ap-el
by Maxious 10y ago
Associated Press offers a data feed http://ap.org/products-services/elections/FAQs http://ap.org/products-services/elections/FAQs https://developer.ap.org/ap-elections-api https://developer.ap.org/ap-elections-api
"Shortly before the polls close, over 4,000 stringers report to county election centers. When the first polls close, they’ll be ready to start phoning in the raw vote as it is reported by the counties. They’ll place their calls to AP election centers around the country.
At the centers, a total of over 800 vote entry clerks will answer those calls, and walk each stringer through a dialogue as they enter the number of precincts reporting and the candidates’ votes into our election night system. "
- tauchunfall 10y agoBut it seems not every news network uses AP data. Google and The Guardian use this data, but for instance some German news channels use another data source. I wrote a script to retrieve the live vote data from Google (i.e. AP) for my chat bot, because I hadn't had the time to find out how the AP API works.
- unixhero 10y agoFor science, would you svare your code? #wanttolearn
- tauchunfall 10y agoSure. It was quickly written in TypeScript nine hours ago. Google provides updates of the sub-DOM using JSON via AJAX. They use CSS class names like `._Lzm` and `._pRo`; similar to those in the HTML version of Google Mail. http://pastebin.com/50fS83qG http://pastebin.com/50fS83qG Sample output (a few hours ago): [["electoral vote","Trump 150 (120 needed) — Clinton 109 (161 needed)"],["popu lar vote","Trump 49% (35,302,284) — Clinton 47% (33,652,539)"],["progress","47 % reporting"]] Sample output (now; notice that needed electoral votes is changed to total popular votes): [["electoral vote","Trump 276 (57,246,646 votes) — Clinton 218 (56,294,331 votes)"],["popular vote","Trump 48% (57,246,646) — Clinton 47% (56,294,331)"],["progress","88% reporting" ]]
- knowtheory 10y agoThe AP's feed isn't free (please remember to pay journalists). News orgs like the NYT, NPR and others pay the AP a decent amount of money to manually go out and collect the results. The AP has writeups of their process too: http://www.ap.org/products-services/elections/FAQs http://www.ap.org/products-services/elections/FAQs http://www.ap.org/products-services/elections/calling-races http://www.ap.org/products-services/elections/calling-races