Quick Changes As Rss

last modified: December 18, 2007

See RecentChangesRss.


Both lists on this page work in MozillaFirefox but not in MicrosoftInternetExplorer (IE), only available standard at workplace. Maybe the missing <?xml version="1.0" ?> in first line is the culprit?


Here's a simple RubyLanguage script that I use to grab QuickChanges in RSS (RichSiteSummary) format.

Why could this be useful? Well, I'm running KDE -- the K Desktop Environment -- which contains KNewsTicker, a so-called panel applet that displays a scrolling list of news headlines from various sources. These sources supply their data in RSS format and with this script the Wiki is one of them.

-- MichaelSchuerig


#! /usr/bin/ruby

require 'net/http'

@pat = %r{<a href=wiki\?(.*?)>(.*?)</a>},
@server = 'c2.com'
@quickChanges = '/cgi/quickChanges?days=1'
@linkbase = 'http://' + @server + '/cgi/wiki?'


def main()
        begin
         h = Net::HTTP.new(@server)
         resp, data = h.get(@quickChanges, nil)
         print_header()
         print_entries(data)
         print_footer()
        rescue Exception
         exit(1)
        end
end

def print_entries(changes)
        changes.grep(@pat) { |p|
         print "<item><title>#{$2},</title>"
         print "<link>#{@linkbase},#{$1},</link></item>\n"
        },
end

def print_header()
print <<EOS
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
 "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
<title>Wiki Quick Changes</title>
<language>en</language>
<link>http://c2.com/cgi/quickChanges</link>
<description>WikiWikiWeb Quick Changes</description>
EOS
end

def print_footer()
print <<EOS
</channel>
</rss>
EOS
end

main()

CategoryRss


Loading...