Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import requests
- import sys
- def findfraud(STATE):
- with open(STATE + '.json', encoding="utf8") as f:
- x = json.load(f)
- segments = x["data"]["races"][0]["timeseries"]
- trumpDiff = 0
- bidenDiff = 0
- print("Checking " + str(len(segments)) + " time segments.")
- for i in range(len(segments)):
- # Skip first segment
- if i != 0:
- votesCounted = segments[i]["votes"] # Votes counted at this time segment
- trumpShare = segments[i]["vote_shares"]["trumpd"] # Trumps share of the vote
- bidenShare = segments[i]["vote_shares"]["bidenj"] # Bidens share of thevote
- lastVotesCounted = segments[i-1]["votes"] # Votes counted in previous time segment
- lastTrumpShare = segments[i-1]["vote_shares"]["trumpd"] # Trumps share of vote in previous segment
- lastBidenShare = segments[i-1]["vote_shares"]["bidenj"] # Bidens share of vote in previous segment
- trumpCount = votesCounted * trumpShare # Trumps current vote count
- lastTrumpCount = lastVotesCounted * lastTrumpShare # Trumps previous vote count
- bidenCount = votesCounted * bidenShare # Bidens current vote count
- lastBidenCount = lastVotesCounted * lastBidenShare # Bidens previous vote count
- # Check if Trump lost votes
- if trumpCount < lastTrumpCount:
- # Check if Biden gained votes
- if bidenCount > lastBidenCount:
- trumpVoteDiff = trumpCount - lastTrumpCount
- bidenVoteDiff = bidenCount - lastBidenCount
- # Print segment info
- print ("WARNING: Anomalous voting data against Trump found. index[" + str(i-1) + "]->[" + str(i) +"]")
- # Print lost votes
- print (" : Trump vote differential: " + str(trumpVoteDiff))
- print (" : Biden vote differential: " + str(bidenVoteDiff))
- trumpDiff += trumpVoteDiff
- bidenDiff += bidenVoteDiff
- # For the sake of fairness, we should check if any of these errors are going the other way
- if bidenCount < lastBidenCount:
- # Check if Biden gained votes
- if trumpCount > lastTrumpCount:
- trumpVoteDiff = trumpCount - lastTrumpCount
- bidenVoteDiff = bidenCount - lastBidenCount
- # Print segment info
- print ("WARNING: Anomalous voting data against Biden found. index[" + str(i-1) + "]->[" + str(i) +"]")
- # Print lost votes
- print (" : Trump vote differential: " + str(trumpVoteDiff))
- print (" : Biden vote differential: " + str(bidenVoteDiff))
- trumpDiff += trumpVoteDiff
- bidenDiff += bidenVoteDiff
- print("State: " + STATE)
- print ("Total Trump Differential: " + str(trumpDiff) + " Flo")
- print ("Total Biden Differential: " + str(bidenDiff) + " Flo")
- def findfraud2(STATE):
- with open(STATE + '.json', encoding="utf8") as f:
- x = json.load(f)
- segments = x["data"]["races"][0]["timeseries"]
- TotalVotesLost = 0
- for i in range(len(segments)):
- if i != 0:
- votesCounted = segments[i]["votes"] # Votes counted at this time segment
- lastVotesCounted = segments[i-1]["votes"] # Votes counted in previous time segment
- if votesCounted < lastVotesCounted:
- TotalVotesLost += votesCounted - lastVotesCounted
- print (TotalVotesLost)
- def main():
- state = ""
- if len(sys.argv) < 2:
- state = input("Enter a state: ").lower()
- else:
- state = sys.argv[1].lower()
- url = "https://static01.nyt.com/elections-assets/2020/data/api/2020-11-03/race-page/" + state + "/president.json"
- data = requests.get(url, allow_redirects=False)
- open(state + '.json', 'wb').write(data.content)
- findfraud(state)
- findfraud2(state)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement