summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/urban.rb
diff options
context:
space:
mode:
authorM. Hecker <apoc@sixserv.org>2014-11-26 02:22:09 +0100
committerM. Hecker <apoc@sixserv.org>2014-11-26 02:22:09 +0100
commit6862a3a010c3299bb43fbccdd726d5cd08e695f3 (patch)
tree36f2441b22ea1d973a1f4b5a52f6b06506f1241a /data/rbot/plugins/urban.rb
parent6423121e96dd602093cbda86de1922e95a45ff07 (diff)
[urban] fix for changed markup
Diffstat (limited to 'data/rbot/plugins/urban.rb')
-rw-r--r--data/rbot/plugins/urban.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/data/rbot/plugins/urban.rb b/data/rbot/plugins/urban.rb
index a23f8742..6d01c625 100644
--- a/data/rbot/plugins/urban.rb
+++ b/data/rbot/plugins/urban.rb
@@ -21,13 +21,15 @@ class UrbanPlugin < Plugin
notfound = s.match %r{<i>.*?</i> isn't defined}
- numpages = if s[%r{<div id='paginator'>.*?</div>}m]
- $&.scan(/\d+/).collect {|x| x.to_i}.max || 1
+ numpages = if s[%r{<ul class="pagination[^"]+">.*?</ul>}m]
+ debug 'foo->'
+ debug $&
+ $&.scan(/>(\d+)</).collect {|x| x[0].to_i}.max || 1
else 1 end
rv = Array.new
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|
+ s.scan(%r{<a class="word"[^>]* 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