X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgooglefight.rb;h=da156fda4e95047b36070fc28b7be1e84247876f;hb=8b811d21babf8f9e5a10a953b595d55ebd08820d;hp=894d2233cdae37c17ccb9131dfc6c597778fee7a;hpb=1158e734a90eef153204b4b68a428ff330287a07;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/googlefight.rb b/data/rbot/plugins/googlefight.rb old mode 100755 new mode 100644 index 894d2233..da156fda --- a/data/rbot/plugins/googlefight.rb +++ b/data/rbot/plugins/googlefight.rb @@ -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}) - res.to_s.tr(",", "").to_i + res = html.scan(%r{About ([\d,]+) results}) + 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"]+?)+/ }