Tweaks
This commit is contained in:
parent
accf84401f
commit
4562f59cab
2 changed files with 2 additions and 7 deletions
|
@ -1,14 +1,11 @@
|
|||
from util import hook, http
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
fml_cache = []
|
||||
|
||||
|
||||
def refresh_cache():
|
||||
""" gets a page of random FMLs and puts them into a dictionary """
|
||||
page = http.get('http://www.fmylife.com/random/')
|
||||
soup = BeautifulSoup(page, 'lxml')
|
||||
soup = http.get_soup('http://www.fmylife.com/random/')
|
||||
|
||||
for e in soup.find_all('div', {'class': 'post article'}):
|
||||
id = int(e['id'])
|
||||
|
|
|
@ -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:
|
||||
|
|
Reference in a new issue