Skip to content

Instantly share code, notes, and snippets.

@torus
Created May 20, 2009 00:42
Show Gist options
  • Save torus/114528 to your computer and use it in GitHub Desktop.
Save torus/114528 to your computer and use it in GitHub Desktop.
(use rfc.http)
(define (t year month day)
(sys-mktime (make <sys-tm>
:hour 12
:mday day
:mon (- month 1)
:year (- year 1900))))
(let ((i (t 2006 10 30)) ; first day
(f (t 2006 11 1))) ; last day
(let loop ((t i))
(if (> t f) #f
(let ((lt (sys-localtime t)))
(let ((y (sys-strftime "%Y" lt))
(m (sys-strftime "%m" lt))
(d (sys-strftime "%d" lt)))
(print #`"retrieving /room/gauche/archives/,|y|/,|m|/,|d|...")
(call-with-output-file #`"lingr-log-,|y|-,|m|-,|d|.html"
(lambda (out)
(http-get "www.lingr.com" #`"/room/gauche/archives/,|y|/,|m|/,|d|"
:sink out :flusher (lambda _ #t))))
(sys-sleep 3)
(loop (+ t (* 60 60 24))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment