summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias H <apoc@sixserv.org>2014-02-21 00:59:07 +0100
committerMatthias H <apoc@sixserv.org>2014-02-21 00:59:07 +0100
commit57cf8fdcef3f4b815be7a2b059e64ea33899caaa (patch)
tree2c984ef80477cf4a27cf5fadd8388c6e70b70c1e
parent53f88ede296c89895c2e0dcd4db729be8cfa2f05 (diff)
[plugin] urban fixed
-rw-r--r--data/rbot/plugins/urban.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/data/rbot/plugins/urban.rb b/data/rbot/plugins/urban.rb
index a15b3622..a23f8742 100644
--- a/data/rbot/plugins/urban.rb
+++ b/data/rbot/plugins/urban.rb
@@ -26,8 +26,10 @@ class UrbanPlugin < Plugin
else 1 end
rv = Array.new
- s.scan(%r{<div class='word'[^>]*>.*?<a class="index"[^>]*>.*?(\d+)\..*?</a>.*?<span>(.*?)</span>.*?<div class="definition">(.+?)</div>.*?<div class="example">(.+?)</div>}m) do |num, wrd, desc, ex|
- rv << [num.to_i, wrd.strip, desc.strip, ex.strip]
+ num = 1
+ s.scan(%r{<div class='word'[^>]*>.*?<a href="\/define[^>]*>([^<]+)</a>.*?<div class='meaning'>(.+?)</div>.*?<div class='example'>(.+?)</div>}m) do |wrd, desc, ex|
+ rv << [num, wrd.strip, desc.strip, ex.strip]
+ num += 1
end
maxnum = rv.collect {|x| x[0]}.max || 0