]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
[plugin] urban fixed
authorMatthias H <apoc@sixserv.org>
Thu, 20 Feb 2014 23:59:07 +0000 (00:59 +0100)
committerMatthias H <apoc@sixserv.org>
Thu, 20 Feb 2014 23:59:07 +0000 (00:59 +0100)
data/rbot/plugins/urban.rb

index a15b36224e05be4586ae82b876555df537a65d58..a23f8742245fd97e4efa23e04af31c4f110ff709 100644 (file)
@@ -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