summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-07-07 21:12:51 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-07-07 21:12:51 +0000
commit90f1ec964d8f02130043974bbb083ed7b1d89b22 (patch)
tree93d373f4b4b40f304293808d8e0e2c0ff70cd27a
parent996cf1c347469f34c351febb1357b0af90184e4a (diff)
Fix Google Calculator regexp and ask for UTF-8 encoded results
-rw-r--r--data/rbot/plugins/search.rb4
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>&nbsp;</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>&nbsp;</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)