Skip to content

Instantly share code, notes, and snippets.

@sesh
Last active November 8, 2016 06:19
Show Gist options
  • Save sesh/7afcf0d7b51f56d4c6eb4d51749d6ff6 to your computer and use it in GitHub Desktop.
Save sesh/7afcf0d7b51f56d4c6eb4d51749d6ff6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from urllib import urlopen
content = urlopen('http://markets.brntn.me').read().decode()
clinton = float(content.split('Clinton:<span class="text-right">')[-1].split('%')[0])
trump = float(content.split('Trump:<span class="text-right">')[-1].split('%')[0])
updated = content.split('Updated: ')[-1].split('\n')[0]
if clinton > trump:
print('Clinton: {}%'.format(clinton))
else:
print('Trump: {}%'.format(trump))
print('---')
print('Clinton: {}%'.format(clinton))
print('Trump: {}%'.format(trump))
print('Updated: {} (UTC)'.format(updated))

Add this as a bitbar script and stare constantly at the leader's chance of winning the US Election (according to Betfair).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment