Skip to content

Instantly share code, notes, and snippets.

@zephyyrr
Created November 24, 2016 19:08
Show Gist options
  • Select an option

  • Save zephyyrr/89a6423bd895e6e8b797974f975489ce to your computer and use it in GitHub Desktop.

Select an option

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
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