Created
November 24, 2016 19:08
-
-
Save zephyyrr/89a6423bd895e6e8b797974f975489ce to your computer and use it in GitHub Desktop.
Quick python script to fetch current donation totals for ESA Dreamhack Winter Highlights 2016 marathon from speedrun.com
This file contains hidden or 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
| import urllib.request | |
| def main(): | |
| url = 'http://www.speedrun.com/ajax_donations.php?marathon=dhw16&action=total' | |
| while (true): | |
| with open('donation_count.txt', 'w') as file: | |
| file.write(clean(get_donations(url))) | |
| def clean(page): | |
| return page.decode("utf-8") | |
| def get_donations(url): | |
| page = urllib.request.urlopen(url) | |
| return page.read() | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment