Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Reddit Karma Status
;;; Quickload
(ql:quickload "cl-json")
(ql:quickload "drakma")
;;; Settings
(defparameter *username* "cliffwarden")
(setq drakma:*header-stream* nil)
(setq drakma:*text-content-types* (cons '("application" . "json")
drakma:*text-content-types*))
;;; Utility
(defun reddit-about-url (username)
(format nil "http://www.reddit.com/user/~A/about.json" username))
;;; Functions
(defun get-about (username)
(json:decode-json-from-string (drakma:http-request (reddit-about-url username\
))))
(defun get-link-karma (about)
(cdr (fifth (cdadr about))))
(defun get-comment-karma (about)
(cdr (sixth (cdadr about))))
(defun get-stats (u)
(let
((about (get-about u)))
(format t "~A: ~A/~A~%" u (get-link-karma about) (get-comment-karma about))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment