音泉クラス
音泉ページから、番組ごとのタイトル・パーソナリティ・ラジオコンテンツのリンク
などを取得する。
class Onsen < Rire::PropertyBase record :xpath => '//td[@bgcolor=#000000]' do has_property :title, :regexp => '<td width="135"[^>]?>(?:(?:<.+?>)*)\s*(.+?)\s*(?:<.+?>)' has_property :link, :regexp => '(http://[^\s]+?\.asx)' has_property :date, :regexp => '(http://[^\s]+?\.asx)' has_property :category, :regexp => '<img height="11" alt="(.+?)!"' has_property :description, :regexp => '<td align="center"><img .+?alt="([^"]+?)"' end after_hook do |entry| next nil if entry.title.nil? || entry.link.nil? entry.description = "#{entry.title} #{entry.description}" entry.category = "" if entry.category.nil? # 年が変わった場合は考慮していない if entry.date =~ /([0-9]{2}[0-9]{2}).asx/ entry.date = Time.parse($1) else entry.date = Time.now end entry end end