Skip to content

Instantly share code, notes, and snippets.

@yancya
Last active May 3, 2018 02:38
Show Gist options
  • Save yancya/31234953bc2ce4e5e3777da1882a9d0b to your computer and use it in GitHub Desktop.
Save yancya/31234953bc2ce4e5e3777da1882a9d0b to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'nokogiri'
require 'date'
CALENDAR_ID = 'mem79137'
today = Date.today
0.upto(5) do |n|
month = today.next_month(n)
id = "#{CALENDAR_ID}_date#{month.year}#{sprintf("%02d", month.month)}"
open("https://freecalend.com/open/#{id}") do |f|
Nokogiri::HTML::parse(f.read).tap do |doc|
doc.css('.caldate').each do |node|
unless node.content.empty?
puts node[:id]
puts node.content.gsub('<br>', "\n")
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment