Skip to content

Instantly share code, notes, and snippets.

@priithaamer
Created September 6, 2011 16:01
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 priithaamer/1197982 to your computer and use it in GitHub Desktop.
Save priithaamer/1197982 to your computer and use it in GitHub Desktop.
NOIRi päevapakkumised
#!/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