Skip to content

Instantly share code, notes, and snippets.

@yagays
Created April 3, 2014 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yagays/9947038 to your computer and use it in GitHub Desktop.
Save yagays/9947038 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'Nokogiri'
require 'pp'
uri = "http://www.agqr.jp/timetable/digital-mf.php"
html = Nokogiri::HTML(open(uri),nil,"utf-8")
html.xpath("//table[@id='timeline']/tbody/tr").each do |timeline|
puts "=============="
if timeline.xpath("th").text != ""
puts "wday = " + timeline.xpath("th").text
else
puts "length = " + timeline.xpath("td").attribute("class").value
puts "Time = " + timeline.xpath("td/strong").text
puts "Title = " + timeline.xpath("td").text.gsub("\n","")
end
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment