               "\n")))))))
 
 (let [results (->> (get-episodes)
-                   (map throttled-id)
+                   (map assoc-cisi-id)
                    (filter identity)
                    (map throttled-options)
                    (remove (comp empty? :streaming-options)))]

    (last
      (clojure.string/split url #"/"))))

(defn assoc-media-id [ep]
  (println "Getting id for" (:media-title ep))
  (let [resp (http/get
               "http://www.canistream.it/services/search"
               {:query-params {:movieName (:media-title ep)}
                :accept :json
                :as :json})
        imdb-id (-> ep :episode-id episode-ids :imdb)]
    (if-let [matching-result (when
                               imdb-id
                               (first
                                 (filter
                                   #(= imdb-id (extract-imdb-id %))
                                   (:body resp))))]
      (assoc
        ep
        :media-id
        (:_id matching-result))
      (println "*** No match found for" (:title ep) "***"))))

(defn assoc-streaming-options [ep]
  (println "Getting options for" (:media-title ep))
  (let [resp (http/get
               "http://www.canistream.it/services/query"
               {:query-params {:movieId (:media-id ep)
                               :attributes true
                               :mediaType "streaming"}
                :accept :json

      :streaming-options
      (->> resp :body vals (map :friendlyName) set))))

(def throttled-options (throttle-fn assoc-streaming-options 1 :second))

(defn format-results [eps]
