X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ffreshmeat.rb;h=3ae887d1714d6fe0a43efdb8db7e74c8c0027986;hb=16336b4a240a4265d1f2df1e30d7b68d3a924287;hp=494cfb48b2374553d4f753e15548d3cc9d845a66;hpb=9a98a241d33d405bb104d27357af64afd4d5e6b2;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/freshmeat.rb b/data/rbot/plugins/freshmeat.rb index 494cfb48..3ae887d1 100644 --- a/data/rbot/plugins/freshmeat.rb +++ b/data/rbot/plugins/freshmeat.rb @@ -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+$/}