]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Googlefight plugin fix
authorOkasu <oka.sux@gmail.com>
Sun, 25 Dec 2011 22:13:30 +0000 (17:13 -0500)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 26 Dec 2011 08:58:30 +0000 (09:58 +0100)
data/rbot/plugins/googlefight.rb

index 894d2233cdae37c17ccb9131dfc6c597778fee7a..7fc748c0f1670f87bad244ac2664505429e081c5 100755 (executable)
@@ -54,11 +54,11 @@ class GoogleFightPlugin < Plugin
   def google_count(query)
     url  = 'http://www.google.com/search?hl=en&safe=off&btnG=Search&q=' << CGI.escape(query)
     html = Net::HTTP.get(URI.parse((url)))
-    res  = html.scan(%r{>About ([\d,]+) results<nobr>})
-    res.to_s.tr(",", "").to_i
+    res  = html.scan(%r{of about <b>([\d,]+)<\/b>})
+    res[0][0].to_s.tr(",", "").to_i
   end
 end
 
 plugin = GoogleFightPlugin.new
 plugin.map "googlefight *keywords", :action => "fight",
-  :requirements => { :keywords => /^[\w\s"]+? (?:(?:(?:\||vs\.) )?[\w\s"]+?)+/ }
\ No newline at end of file
+  :requirements => { :keywords => /^[\w\s"]+? (?:(?:(?:\||vs\.) )?[\w\s"]+?)+/ }