Skip to content

Instantly share code, notes, and snippets.

@Chouser
Forked from hiredman/utilities.clj
Created May 28, 2009 15:30
Show Gist options
  • Save Chouser/119384 to your computer and use it in GitHub Desktop.
Save Chouser/119384 to your computer and use it in GitHub Desktop.
(import '(java.net URL) '(java.io InputStreamReader BufferedReader))
(defn get-url [x]
(with-open [a (-> (doto (-> x URL. .openConnection)
(.setRequestProperty "User-Agent" "clojurebot"))
.getInputStream InputStreamReader. BufferedReader.)]
(apply str (take-while identity (repeatedly #(.readLine a))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment