diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-07-07 21:12:51 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-07-07 21:12:51 +0000 |
commit | 90f1ec964d8f02130043974bbb083ed7b1d89b22 (patch) | |
tree | 93d373f4b4b40f304293808d8e0e2c0ff70cd27a /data/rbot | |
parent | 996cf1c347469f34c351febb1357b0af90184e4a (diff) |
Fix Google Calculator regexp and ask for UTF-8 encoded results
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/search.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb index b8825bcb..c4bf0db1 100644 --- a/data/rbot/plugins/search.rb +++ b/data/rbot/plugins/search.rb @@ -16,7 +16,7 @@ # for most languages GOOGLE_WAP_LINK = /<a accesskey="(\d)" href=".*?u=(.*?)">(.*?)<\/a>/im -GOOGLE_CALC_RESULT = %r{<p><table><tr><td><img src=/images/calc_img\.gif></td><td> </td><td nowrap><font size=\+1><b>(.+)</b></td></tr><tr><td>} +GOOGLE_CALC_RESULT = %r{<p><table><tr><td><img src=/images/calc_img\.gif(?: alt="")?></td><td> </td><td nowrap>(?:<h2 class=r>)?<font size=\+1><b>(.+)</b>(?:</h2>)?</td></tr><tr><td>} class SearchPlugin < Plugin BotConfig.register BotConfigIntegerValue.new('google.hits', @@ -108,7 +108,7 @@ class SearchPlugin < Plugin searchfor = CGI.escape(what) debug "Getting gcalc thing: #{searchfor.inspect}" - url = "http://www.google.com/search?q=#{searchfor}" + url = "http://www.google.com/search?oe=UTF-8&q=#{searchfor}" begin html = @bot.httputil.get(url) |