Forgot to add this -.-
This commit is contained in:
parent
62cf93bd52
commit
accf84401f
2 changed files with 5 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
Reference in a new issue