Skip to content

Instantly share code, notes, and snippets.

@chrisforbes
Created September 4, 2011 21:51
Show Gist options
  • Save chrisforbes/1193568 to your computer and use it in GitHub Desktop.
Save chrisforbes/1193568 to your computer and use it in GitHub Desktop.
Python makes parsing the OpenRA Game List EASY!
>>> import yaml
>>> import urllib2
>>> content = urllib2.urlopen('http://master.open-ra.org/list.php').read()
>>> y = yaml.load(content.replace('\t',' '))
>>> print y
{'Game@0': {'Map': '700c39e1f70c06ee7a9dd119720234c3132231a0', 'Mods': 'ra', 'Name': 'OpenRA', 'Address': '82.124.81.35:1234', 'Players': 1, 'State': 2, 'TTL': 195, 'Id': 202253}, 'Game@1': {'Map': 'f9ce9066950638c1b10e9d2d34071a4adacb8071', 'Mods': 'ra@playtest-20110904', 'Name': 'not down', 'Address': '174.52.251.86:1234', 'Players': 6, 'State': 1, 'TTL': 299, 'Id': 202278}}
>>> y['Game@0']['Map']
'700c39e1f70c06ee7a9dd119720234c3132231a0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment