 (ns clueweb-disqus.core
   (:require [cheshire.core :refer :all]
             [clj-http.client :as client]
+            [clj-time.coerce :as c]
             [clj-time.core :as t]
+            [clj-time.format :as f]
             [clojure.java.io :as io])
   (:use [clojure.pprint :only [pprint]]))
 

        filename-to-write (str start-epoch "-" writer-file-name)
        stats-f-to-write (str start-epoch "-" stats-file-name)]
    (do (with-open [wrtr (io/writer filename-to-write :append true)]
          (pprint content-to-write wrtr))
        (if (.exists (java.io.File. stats-f-to-write))
          (let [count
                (inc (read-string (slurp stats-f-to-write)))]
            (spit stats-f-to-write count))))))

(defn discover-iteration
  [start-epoch first-page-content]


            next-pg-content (rate-limited-download next-pg-url)]
        (write-content start-epoch next-pg-content)
        (when-not (stop-iteration? start-epoch (get next-pg-content "response"))
          (recur start-epoch
                 next-pg-content))))))

(defn threads-since
  [start-epoch]
  (let [request-url (create-url start-epoch)
        first-page  (rate-limited-download request-url)]
    (write-content start-epoch first-page)
    (discover-iteration start-epoch first-page)))
