Forgot to add this -.-

This commit is contained in:
Luke Rogers 2012-09-05 11:09:54 +12:00
parent 62cf93bd52
commit accf84401f
2 changed files with 5 additions and 2 deletions

View file

@ -19,11 +19,9 @@ def fact(inp, say=False, nick=False):
response = soup.find('a', {'class': 'surprise'})
link = response['href']
#fact = response.contents[0]
fact = ''.join(response.find(text=True))
if fact:
print fact
fact = http.unescape(fact.decode("utf-8")).strip()
break
else:

View file

@ -9,6 +9,7 @@ import urlparse
from urllib import quote, quote_plus as _quote_plus
from lxml import etree, html
from bs4 import BeautifulSoup
# used in plugins that import this
from urllib2 import URLError, HTTPError
@ -35,6 +36,10 @@ def get_html(*args, **kwargs):
return html.fromstring(get(*args, **kwargs))
def get_soup(*args, **kwargs):
return BeautifulSoup(get(*args, **kwargs), 'lxml')
def get_xml(*args, **kwargs):
return etree.fromstring(get(*args, **kwargs))