Created
August 21, 2011 01:27
-
-
Save srid/1159952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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