summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-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 60a70c54..2a1b3dc1 100644
--- a/data/rbot/plugins/search.rb
+++ b/data/rbot/plugins/search.rb
@@ -183,13 +183,15 @@ class SearchPlugin < Plugin
debug "#{html.size} bytes of html recieved"
- intro, result, junk = html.split(/\s*<br\/>\s*/, 3)
- debug "result: #{result.inspect}"
+ splits = html.split(/\s*<br\/>\s*/)
+ candidates = splits.select { |section| section.include? ' = ' }
+ debug "candidates: #{candidates.inspect}"
- unless result.include? '='
+ if candidates.empty?
m.reply "couldn't calculate #{what}"
return
end
+ result = candidates.first
debug "replying with: #{result.inspect}"
m.reply result.ircify_html