From 4562f59cab8b1270afa6fb2a7d8e7a3dc66bf497 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Wed, 5 Sep 2012 11:41:32 +1200 Subject: [PATCH] Tweaks --- plugins/fmylife.py | 5 +---- plugins/gcalc.py | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/fmylife.py b/plugins/fmylife.py index bfc43c2..85fb534 100755 --- a/plugins/fmylife.py +++ b/plugins/fmylife.py @@ -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']) diff --git a/plugins/gcalc.py b/plugins/gcalc.py index 59c8dbd..b419f5f 100755 --- a/plugins/gcalc.py +++ b/plugins/gcalc.py @@ -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 -- Calculate 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: