#!/usr/local/bin/ruby # Khorben has a (tiny) blog \o/ # It's hand-made ._. # It has no rss/atom feed /o\ # ... # OMG! ruby, web 2.0! Quick-Attack! require 'rubygems' require 'feedalizer' require 'time' require 'hpricot' url = "http://people.defora.org/~khorben/blog.html" path = url.gsub(/(.*)\/(.*)$/, '\1/') rss = feedalize(url) do feed.title = "I said I'd never blog" feed.description = "DeforaOS, NetBSD, reverse-engineering and stuff" feed.about = "..." scrape_items("//div[@class=post]") do |rss_item, html_element| rss_item.link = url rss_item.date = Time.parse( html_element.search("//div[@class=date]").first.inner_html ) rss_item.title = html_element.search("//div[@class=title]").first.inner_html # absolutize href-s in anchors when needed. description = html_element.search("//div[@class=content]").first description.search('//a[@href]') do |a| next if a[:href] =~ /:\/\// a[:href] = path + a[:href] end rss_item.description = description.to_html end output! end