Skip to content

Instantly share code, notes, and snippets.

@bo-tato
Created September 26, 2023 16:59
Show Gist options
  • Save bo-tato/9df8182150dc49d0943f13635430b647 to your computer and use it in GitHub Desktop.
Save bo-tato/9df8182150dc49d0943f13635430b647 to your computer and use it in GitHub Desktop.
#commonlisp irc archive reader
(in-package :ciel-user)
(use-package '(local-time periods))
(import 'periods::do-times)
(defconstant +last-date-file+ "~/.irc-log-reader-last")
(defun fmt-date (date)
(format-timestring nil date :format +rfc3339-format/date-only+))
(do-times (day (-> +last-date-file+ str:from-file str:trim parse-timestring)
(duration :days 1)
(today))
(let* ((url #?"https://libera.irclog.whitequark.org/commonlisp/${(fmt-date day)}")
(doc (lquery:$ (initialize (dex:get url)))))
(format t "~%:: ~a ::~%" day)
(lquery:$ doc ".talk.op-msg" (text)
(map [#'println {substitute #\Space #\Newline}]))))
(str:to-file +last-date-file+ (fmt-date (today)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment