Last active
August 29, 2015 14:02
-
-
Save JBKahn/d2b8feae3855983f07ba to your computer and use it in GitHub Desktop.
Success
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
beautifulsoup4==4.3.2 | |
requests==2.3.0 |
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
import random | |
import requests | |
from bs4 import BeautifulSoup | |
if __name__ == "__main__": | |
wiki_page = "http://streetfighter.wikia.com/wiki/List_of_moves_in_Street_Fighter_II" | |
r = requests.get(wiki_page) | |
soup = BeautifulSoup(r.content) | |
games = soup.find_all("tr") | |
while True: | |
choice = random.choice(games) | |
move = choice.getText().split('\n')[1] | |
if move == u'Move Name': | |
continue | |
character = choice.find_parent('table').findPreviousSibling('h2').text.replace('Edit', '') | |
if move.lower().find('super combo') > -1: | |
link = "http://streetfighter.wikia.com" + choice.find_all('a')[1].get('href') | |
else: | |
link = "http://streetfighter.wikia.com" + choice.find_next('a').get('href') | |
print "{}: {} ({})".format(character, move, link) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment