forgot to remove debug print statement~
This commit is contained in:
parent
9deb8e244a
commit
61a8706fed
|
@ -1,6 +1,6 @@
|
||||||
from lxml import html
|
import lxml
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import hook
|
import hook
|
||||||
|
|
||||||
@hook.command('u')
|
@hook.command('u')
|
||||||
|
@ -12,11 +12,9 @@ def urban(inp):
|
||||||
|
|
||||||
url = 'http://www.urbandictionary.com/define.php?term=' + \
|
url = 'http://www.urbandictionary.com/define.php?term=' + \
|
||||||
urllib.quote(inp.strip(), safe='')
|
urllib.quote(inp.strip(), safe='')
|
||||||
page = html.parse(url)
|
page = lxml.html.parse(url)
|
||||||
defs = page.xpath("//div[@class='definition']")
|
defs = page.xpath("//div[@class='definition']")
|
||||||
|
|
||||||
print repr(defs[0].text_content())
|
|
||||||
|
|
||||||
if not defs:
|
if not defs:
|
||||||
return 'no definitions found'
|
return 'no definitions found'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue