diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-23 17:53:49 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-23 17:53:49 +0000 |
commit | 37ce944a1bd432f329662b8d2b28c55ef995d928 (patch) | |
tree | 4a9bbf84f358b2eb9fee83eddb86c418afce0bfb /data/rbot/plugins/urban.rb | |
parent | 6586b6348153951ec70c9237fb5358d8914c3272 (diff) |
urban dictionary now uses get_cached. It's still slow, though, so we can safely say it's not a cache problem. It looks like it should cache the parsed bodies itself ...
Diffstat (limited to 'data/rbot/plugins/urban.rb')
-rw-r--r-- | data/rbot/plugins/urban.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/data/rbot/plugins/urban.rb b/data/rbot/plugins/urban.rb index d4af64a6..f95eabd6 100644 --- a/data/rbot/plugins/urban.rb +++ b/data/rbot/plugins/urban.rb @@ -37,11 +37,11 @@ class UrbanPlugin < Plugin uri = URI.parse( "http://www.urbandictionary.com/define.php?term=#{ URI.escape query}" ) end - soup = BeautifulSoup.new( @bot.httputil.get( uri ) ) + soup = BeautifulSoup.new( @bot.httputil.get_cached( uri ) ) if titleNavi = soup.find_all( 'td', :attrs => { 'class' => 'def_word' } )[0] then title = titleNavi.contents results = soup.find_all( 'div', :attrs => { 'class' => 'def_p' } ) - debug PP.pp(results,'') + # debug PP.pp(results,'') output = Array.new if results[definitionN] then results[definitionN].p.contents.each { |s| output.push( strip_tags( s.to_s ) ) } |