From 43e9303ba42450e50db298b8e0f543765c1385be Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Tue, 21 Jul 2009 14:13:35 -0600 Subject: [PATCH] make urbandictionary say word name --- plugins/urbandictionary.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/urbandictionary.py b/plugins/urbandictionary.py index a6b8ce1..4ca690a 100644 --- a/plugins/urbandictionary.py +++ b/plugins/urbandictionary.py @@ -14,12 +14,14 @@ def urban(inp): url = 'http://www.urbandictionary.com/define.php?term=' + \ urllib.quote(inp.strip(), safe='') page = html.parse(url) + words = page.xpath("//td[@class='word']") defs = page.xpath("//div[@class='definition']") if not defs: return 'no definitions found' - out = ' '.join(defs[0].text_content().split()) + out = words[0].text_content().strip() + ' '.join( + defs[0].text_content().split()) if len(out) > 400: out = out[:out.rfind(' ', 0, 400)] + '...'