Skip to content

Instantly share code, notes, and snippets.

@siuying
Created May 31, 2009 09:13
Show Gist options
  • Save siuying/120825 to your computer and use it in GitHub Desktop.
Save siuying/120825 to your computer and use it in GitHub Desktop.
# scRUBYt script that parse tvb scheule and return XML
# Sample Output: http://gist.github.com/120827
#
require 'rubygems'
require 'scrubyt'
tvb = Scrubyt::Extractor.define do
fetch "http://schedule.tvb.com/j2/20090531.html?category=all"
schedule "//div[@class='content']" do
program "//tr" do
time "//td[1]"
name "//td[2]/span[1]"
details "//td[2]/div"
end.ensure_presence_of_pattern("time").ensure_presence_of_pattern("name")
end
end
puts tvb.to_xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment