peterc (owner)

Revisions

gist: 83625 Download_button fork
public
Public Clone URL: git://gist.github.com/83625.git
Embed All Files: show embed
useit.cgi #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/ruby
 
# Fetch Jakob Nielsen's Alertbox and turn it into a basic RSS feed
 
%w{rubygems hpricot open-uri rss/maker}.each { |l| require l }
 
puts "Content-type: text/xml\n\n"
 
feed = RSS::Maker.make("2.0") do |rss|
  rss.channel.title = "Jakob Nielsen's Alertbox"
  rss.channel.link = "http://useit.com/alertbox"
  rss.channel.description = "Jakob Nielsen's Alertbox"
  (Hpricot(open('http://www.useit.com/alertbox')) / "li a").first(10).each do |link|
    item = rss.items.new_item
    item.title = link.inner_text
    item.link = "http://www.useit.com/alertbox/" + link.attributes['href']
  end
end
 
puts feed