Skip to content

Instantly share code, notes, and snippets.

@kartben
Last active December 11, 2015 02:49
Show Gist options
  • Save kartben/4533585 to your computer and use it in GitHub Desktop.
Save kartben/4533585 to your computer and use it in GitHub Desktop.
require 'rss'
require 'pp'
require 'rss/dublincore'
$totals = Hash.new(0)
$authors = Hash.new(0)
FORUM_ID = 221 # replace this with your frm_id
def calculate(feed)
feed.items.reverse.map.each do |item|
$totals[item.date.strftime("%d/%m/%Y")] += 1
$authors[item.dc_creator] += 1
end
end
# it's not possible to get the whole RSS feed at once, so we fetch it by chunks of 50 items
# you might want to iterate more than 8 times in the following loop, if you want to retrieve more than just the 400 last posts...
for i in (0..8)
rss = RSS::Parser.parse("http://www.eclipse.org/forums/feed.php?mode=m&l=1&basic=1&frm=#{FORUM_ID}&n=50&o=#{i*50}", true)
if rss.respond_to?('items') then calculate(rss) end
end
$totals.each do |k,v| puts "#{k}\t#{v}" end
$authors.sort_by {|k,v| v}.reverse.each do |k,v| puts "#{k}\t#{v}" end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment