Created
September 6, 2011 16:01
-
-
Save priithaamer/1197982 to your computer and use it in GitHub Desktop.
NOIRi päevapakkumised
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
print = false | |
doc = Nokogiri::HTML(open("http://www.cafenoir.ee/noir/")) | |
doc.css('table.contentpaneopen:nth-child(2) p').each do |p| | |
print = false if p.text =~ /Sinu NOIR/ | |
print = true if p.text =~ /PAKKUMINE/ | |
if print | |
p.search('br').each{ |br| br.replace(Nokogiri::XML::Text.new("\n", p.document)) } | |
puts p.text | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment