]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
urban dictionary now uses get_cached. It's still slow, though, so we can safely say...
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 23 Jul 2006 17:53:49 +0000 (17:53 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 23 Jul 2006 17:53:49 +0000 (17:53 +0000)
data/rbot/plugins/urban.rb

index d4af64a6295b3f27f02abe8c9dcaa1cd4486fadd..f95eabd6f35e23ec88f26cbe5ba31fd1ad038aa3 100644 (file)
@@ -37,11 +37,11 @@ class UrbanPlugin < Plugin
       uri = URI.parse( "http://www.urbandictionary.com/define.php?term=#{ URI.escape query}" )
     end
 
       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' } )
     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 ) ) }
       output = Array.new
       if results[definitionN] then
         results[definitionN].p.contents.each { |s| output.push( strip_tags( s.to_s ) ) }