This commit is contained in:
Luke Rogers 2012-09-05 11:41:32 +12:00
parent accf84401f
commit 4562f59cab
2 changed files with 2 additions and 7 deletions

View file

@ -1,5 +1,4 @@
from util import hook, http
from bs4 import BeautifulSoup
@hook.command("math")
@ -7,8 +6,7 @@ from bs4 import BeautifulSoup
def calc(inp):
"calc <term> -- Calculate <term> with Google Calc."
page = http.get('http://www.google.com/search', q=inp)
soup = BeautifulSoup(page, 'lxml')
soup = http.get_soup('http://www.google.com/search', q=inp)
response = soup.find('h2', {'class': 'r'})
if response is None: