diff options
author | Matthias H <apoc@sixserv.org> | 2014-02-21 00:59:07 +0100 |
---|---|---|
committer | Matthias H <apoc@sixserv.org> | 2014-02-21 00:59:07 +0100 |
commit | 57cf8fdcef3f4b815be7a2b059e64ea33899caaa (patch) | |
tree | 2c984ef80477cf4a27cf5fadd8388c6e70b70c1e /data | |
parent | 53f88ede296c89895c2e0dcd4db729be8cfa2f05 (diff) |
[plugin] urban fixed
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/urban.rb | 6 |
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 |