Skip to content

Instantly share code, notes, and snippets.

@kgleeson
Created August 30, 2012 12:10
Show Gist options
  • Select an option

  • Save kgleeson/3527319 to your computer and use it in GitHub Desktop.

Select an option

Save kgleeson/3527319 to your computer and use it in GitHub Desktop.
import urllib2
import re
url = 'http://wiki.shoryuken.com/index.php?title=Super_Street_Fighter_IV_AE/Abel&action=edit'
def test(url):
data = read_url_data(url)
table = find_move_table(data)
print find_moves_data(table)
def read_url_data(url):
f = urllib2.urlopen(url)
return f.read()
def find_move_table(data):
movesRE = re.compile('==Frame Data==(.+)=====Notes:=====', re.DOTALL)
return movesRE.findall(data)[0]
def find_moves_data(data):
regex = re.compile(r'''\|-\ \n
\|.+?\|(?P<Move>.+?)\n
\|.+?\|(?P<HL>.+?)\n
\|.+?\|(?P<Damage>.+?)\n
\|.+?\|(?P<Stun>.+?)\n
\|.+?\|(?P<Gain>.+?)\n
\|.+?\|(?P<Cancel>.+?)\n
\|.+?\|(?P<Startup>.+?)\n
\|.+?\|(?P<Active>.+?)\n
\|.+?\|(?P<Recovery>.+?)\n
\|.+?\|(?P<Block>.+?)\n
\|.+?\|(?P<Hit>.+?)\n
(?:|\|.+?\|(?P<Notes>.+?)\n)
''',re.DOTALL|re.VERBOSE)
return regex.search(data).groupdict()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment