summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/search.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb
index 3b0fac5f..595dab3c 100644
--- a/data/rbot/plugins/search.rb
+++ b/data/rbot/plugins/search.rb
@@ -17,7 +17,8 @@
GOOGLE_SEARCH = "http://www.google.com/search?oe=UTF-8&q="
GOOGLE_WAP_SEARCH = "http://www.google.com/m/search?hl=en&q="
-GOOGLE_WAP_LINK = /<a accesskey="(\d)" href=".*?u=(.*?)">(.*?)<\/a>/im
+# GOOGLE_WAP_LINK = /<a accesskey="(\d)" href=".*?u=(.*?)">(.*?)<\/a>/im
+GOOGLE_WAP_LINK = /<a href="(?:.*?u=(.*?)|(http:\/\/.*?))">(.*?)<\/a>/im
GOOGLE_CALC_RESULT = %r{<img src=/images/calc_img\.gif(?: width=40 height=30 alt="")?>.*?<h2 class=r[^>]*><b>(.+?)</b>}
GOOGLE_COUNT_RESULT = %r{<font size=-1>Results <b>1<\/b> - <b>10<\/b> of about <b>(.*)<\/b> for}
GOOGLE_DEF_RESULT = %r{<p> (Web definitions for .*?)<br/>(.*?)<br/>(.*?)\s-\s+<a href}
@@ -91,10 +92,11 @@ class SearchPlugin < Plugin
end
single ||= (results.length==1)
urls = Array.new
+ n = 0
results = results[0...hits].map { |res|
- n = res[0]
+ n += 1
t = Utils.decode_html_entities res[2].gsub(filter, '').strip
- u = URI.unescape res[1]
+ u = URI.unescape(res[0] || res[1])
urls.push(u)
single ? u : "#{n}. #{Bold}#{t}#{Bold}: #{u}"
}.join(" | ")