Tuesday, January 18, 2005

Subscribe to JavaBlogs daily feed in NetNewsWire

The RSS daily feed of javablogs is in the form of
    http://www.javablogs.com/ViewDaysBlogs.action?date=19&month=0&year=2005
Therefore the feed for today's entry is dynamic and changes every day. This kind of feed can be easily handled by script subscription in NetNewsWire 2.0. Below is the ruby script to do just that.
#!/usr/local/bin/ruby -w

require 'date'
require 'open-uri'
require 'stringio'

d = DateTime.now

op = StringIO.new("", "w")

open("http://www.javablogs.com/ViewDaysBlogs.action?date=#{d.mday}&month=#{d.month - 1}&year=#{d.year}&view=rss",
    :proxy => nil) do |rss|
    rss.each_line {|line| op.puts line}
end


puts op.string

Technorati Tags: , ,

No comments: