8 ms·
But 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
by tauchunfall 10y ago
But 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