Last active
May 3, 2018 02:38
-
-
Save yancya/31234953bc2ce4e5e3777da1882a9d0b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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