Python makes this stuff too easy xD
This commit is contained in:
parent
97d250ca27
commit
9f2bffa7a5
1 changed files with 3 additions and 3 deletions
|
@ -8,8 +8,8 @@ def calc(inp):
|
||||||
|
|
||||||
soup = http.get_soup('http://www.google.com/search', q=inp)
|
soup = http.get_soup('http://www.google.com/search', q=inp)
|
||||||
|
|
||||||
response = soup.find('h2', {'class': 'r'})
|
result = soup.find('h2', {'class': 'r'})
|
||||||
if response is None:
|
if not result:
|
||||||
return "Could not calculate '%s'" % inp
|
return "Could not calculate '%s'" % inp
|
||||||
|
|
||||||
return http.unescape(response.contents[0])
|
return result.contents[0]
|
||||||
|
|
Reference in a new issue