Skip to content

Instantly share code, notes, and snippets.

@srid
Created August 21, 2011 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srid/1159952 to your computer and use it in GitHub Desktop.
Save srid/1159952 to your computer and use it in GitHub Desktop.
(ns notaskinnerbox.stackexchange
(:require [clj-http.client :as client])
(:import (java.util.zip GZIPInputStream)
(java.io ByteArrayInputStream)))
(defn top-posts-url
[site]
"http://api.stackoverflow.com/1.1/questions?fromdate=1313203687&sort=votes&tagged=clojure")
(defn gzcat
[string]
(let [bstring (ByteArrayInputStream. (.getBytes string))
in (GZIPInputStream. bstring)]
(.read in)
(.close in)))
(defn top-posts-last-week
[site]
(gzcat ((client/get (top-posts-url site)) :body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment