Brian's Waste of Time

Sat, 12 Mar 2005

Speaking of RSS...

An unnamed JavaBlogger posted about his JavaBlogs pre-processor, so I figured I'd post about my bloglines monitoring script:

#!/usr/bin/env ruby

require 'net/http'
require 'rexml/document'
require 'stringio'

LOGIN = 'bloglines_account@example.com'
PASS = 's3kr3t_bl0gl1n3s_p4ssw0rd'

Net::HTTP.start('rpc.bloglines.com') do |http|
  request = Net::HTTP::Get.new('/getitems?s=0&n=0')
  request.basic_auth LOGIN, PASS
  response = http.request(request)
  REXML::Document.new(response.body).elements.each('//channel') do |channel|
    puts "#{channel.elements['title'].text}"
    channel.each_element('item') do |item|
      puts "  #{item.elements['title'].text}"
    end
  end
end

Which just does a nicely formatted title-by-blog listing of your unread stuff on bloglines. Combined with GeekTool it's pretty handy =)

3 writebacks [/src/ruby] permanent link