]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/freshmeat.rb
markov: refactor triplet learning
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / freshmeat.rb
index 494cfb48b2374553d4f753e15548d3cc9d845a66..3ae887d1714d6fe0a43efdb8db7e74c8c0027986 100644 (file)
@@ -49,7 +49,13 @@ class FreshmeatPlugin < Plugin
       m.reply "search for #{search} failed"
       return
     end
-    doc = Document.new xml
+    doc = nil
+    begin
+      doc = Document.new xml
+    rescue
+      debug xml
+      error $!
+    end
     unless doc
       m.reply "search for #{search} failed"
       return
@@ -82,12 +88,12 @@ class FreshmeatPlugin < Plugin
       m.reply reply
     }
   end
-  
+
   def freshmeat(m, params)
     max = params[:limit].to_i
     max = 8 if max > 8
     begin
-      xml = @bot.httputil.get('http://images.feedstermedia.com/feedcache/ostg/freshmeat/fm-releases-global.xml')
+      xml = @bot.httputil.get('http://freshmeat.net/backend/fm-releases-global.xml')
       unless xml
         m.reply "freshmeat news parse failed"
         return
@@ -107,8 +113,8 @@ class FreshmeatPlugin < Plugin
     title_width = 0
     done = 0
     doc.elements.each("*/channel/item") {|e|
-      desc = e.elements["description"].text
-      title = e.elements["title"].text
+      desc = e.elements["description"].text.ircify_html
+      title = e.elements["title"].text.ircify_html
       #title.gsub!(/\s+\(.*\)\s*$/, "")
       title.strip!
       title_width = title.length if title.length > title_width
@@ -128,5 +134,5 @@ end
 plugin = FreshmeatPlugin.new
 plugin.map 'freshmeat search :limit *search', :action => 'search_freshmeat',
             :defaults => {:limit => 4}, :requirements => {:limit => /^\d+$/}
-plugin.map 'freshmeat :limit', :defaults => {:limit => 4}, 
+plugin.map 'freshmeat :limit', :defaults => {:limit => 4},
                                :requirements => {:limit => /^\d+$/}