Skip to content

Instantly share code, notes, and snippets.

@ainame
Created December 31, 2011 08:43
Show Gist options
  • Select an option

  • Save ainame/1543416 to your computer and use it in GitHub Desktop.

Select an option

Save ainame/1543416 to your computer and use it in GitHub Desktop.
require 'active_support/time'
unless ARGV[0]
puts 'usage: ruby twilog.rb SCREEN_NAME YEAR'
exit(1)
end
screen_name = ARGV[0]
year = ARGV[1] || Date.today.year
`mkdir -p twilog/#{screen_name}`
date = Date.new(year)
Date::DATE_FORMATS[:twilog] = "%y%m%d"
365.times do |i|
format = date.since(i.days).to_date.to_s(:twilog)
`curl -o twilog/#{screen_name}/#{format}.html http://twilog.org/#{screen_name}/date-#{format}`
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment