X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgooglefight.rb;h=da156fda4e95047b36070fc28b7be1e84247876f;hb=db97054c4ecdb228f313df5a3a0191aff9745a88;hp=0b9393ef0c67c975aa97b61a9c31315fc3b24bbc;hpb=783ffa4235330029d661752b1023db635b26f2b3;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 0b9393ef..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{Results 1 - \d+ of(?: about)? ([\d,]+)}) - 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"]+?)+/ }