Add this as a bitbar script and stare constantly at the leader's chance of winning the US Election (according to Betfair).
Last active
November 8, 2016 06:19
-
-
Save sesh/7afcf0d7b51f56d4c6eb4d51749d6ff6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment