#!/usr/bin/env ruby require 'net/http' require 'cgi' host, path = 'en.wikipedia.org', '/w/api.php' cgi = CGI.new http = Net::HTTP.new(host) req = Net::HTTP::Post.new(path) req.set_form_data :action => 'login', :lgname => cgi['username'], :lgpassword => cgi['password'] res = http.start { |h| h.request(req) } header = { 'Cookie' => res['set-cookie'].scan(/enwiki.+?=.+?;/).join(' '), 'User-Agent' => 'watchlist.rb script (http://mpov.wordpress.com/2007/02/19/wikipedia-watchlist-feed-v2/)' } res, body = http.get(path + '?action=feedwatchlist&feedformat=rss', header) puts "content-type:text/xml\n\n" puts body