Skip to content

Instantly share code, notes, and snippets.

@jurgenwerk
Created March 30, 2019 14:20
Show Gist options
  • Save jurgenwerk/e569ee2b1a3e1b9d580b903953da2de4 to your computer and use it in GitHub Desktop.
Save jurgenwerk/e569ee2b1a3e1b9d580b903953da2de4 to your computer and use it in GitHub Desktop.
Ruby script to check if Boros Sammlung in Berlin has any free space on provided dates
url = "https://www.sammlung-boros.de/visit/fuehrungen-buchen.html?L=1#item_2"
date_range = Date.parse("10-05-2019")..Date.parse("13-05-2019")
html = open(url)
doc = Nokogiri::HTML(html)
doc.search(".block_empty").map do |b|
[b.parent.parent.parent.search("h1").text.split(",")[1].strip, b.parent.text.chomp.strip]
end.select { |r| Date.parse(r[0]).in?(date_range) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment