     (catch Exception e 0.0)))
 
 (defn- remove-comma [s]
-  (str/replace-first s "," ""))
+  (string/replace-first s "," ""))
 
 (defn imdb-rating-count [dp]
   (try
     (->> dp
-         (h/select (h/descendant
-                     (h/id :ratings-bar)
-                     h/first-child
-                     (h/class :inline-block)
-                     (h/class :text-muted)))
+         (hickory/select (hickory/descendant
+                           (hickory/id :ratings-bar)
+                           hickory/first-child
+                           (hickory/class :inline-block)
+                           (hickory/class :text-muted)))
          first
          :content
          last

    (async-get url result-ch error-ch)))

(defn fetch-imdb-dp [error-ch movie-ch result-ch]
  (a/go
    (let [movie (a/<! movie-ch)]
      (async-get (:imdb-url movie) result-ch error-ch)
      movie)))

(defn rotate-article [title]
  (let [pattern (Pattern/compile "^([\\w\\s]+), (Der|Die|Das|The)", Pattern/UNICODE_CHARACTER_CLASS)]
    (str/replace-first title pattern "$2 $1")))

(defn remove-dimension [title]
  (let [pattern (Pattern/compile " (- )?2D.*", Pattern/UNICODE_CHARACTER_CLASS)]
    (str/replace-first title pattern "")))

(defn yorck-titles [yorck-page]
  (->> yorck-page
       (h/select (h/descendant
                   (h/class :movie-details)
                   (h/tag :h2)))
       (mapcat :content)
       (mapv rotate-article)
       (mapv remove-dimension)))

(defn yorck-urls [yorck-page]
  (->> yorck-page
       (h/select (h/descendant
                   (h/class :movie-details)
                   (h/tag :a)))
       (mapv :attrs)
       (map :href)
       (map #(str yorck-base-url %))))

   :imdb-url   (imdb-url sp)})

(defn with-imdb-sp-infos [movie ch]
  (async/go (merge movie (imdb-sp-infos (async/<! ch)))))

(defn with-rating [movie-ch dp-ch]
  (async/go
    (let [movie (async/<! movie-ch)
          page (async/<! dp-ch)]
      (merge movie {:rating (imdb-rating page)
                    :rating-count (imdb-rating-count page)}))))

(defn remove-sneak-preview [movies]
  (remove #(string/includes? (string/lower-case (:yorck-title %)) "sneak") movies))

(defn rated-movies [cb]
  (async/go
    (let [result-ch (async/chan 1 (comp
                                (map yorck-titles-urls)
                                (map remove-sneak-preview)))
          error-ch (async/chan)
          imdb-sp-chs (repeatedly (partial async/chan 1))
          imdb-dp-chs (repeatedly (partial async/chan 1))

          _ (fetch-yorck-list result-ch error-ch)

          yorck-infos (async/<! result-ch)

          _ (doall (map #(fetch-imdb-sp error-ch %1 %2) yorck-infos imdb-sp-chs))
          movie-chs (map with-imdb-sp-infos yorck-infos imdb-sp-chs)
          m-chs (doall (map #(fetch-imdb-dp error-ch %1 %2) movie-chs imdb-dp-chs))
          rated-movie-chs (map with-rating m-chs imdb-dp-chs)]

      (async/map (fn [& movies] (cb (reverse (sort-by :rating movies)))) rated-movie-chs)
      (async/close! result-ch)
      (async/close! error-ch)
      (map async/close! imdb-sp-chs)
      (map async/close! imdb-dp-chs))))
