(defn view-input [] (view-layout [:h2 "Find your Movie"] [:body {:style "font: 14pt/16pt helvetica; background-color: #F2FB78; padding-top:100px; text-align: center" } (form-to [:post "/"] [:br] [:br] (text-field {:placeholder "Enter movie name" } :a) [:br] (submit-button "Search") )]))
(defn create-flick-url [a]
(defn view-output2 [a] (view-layout [:h2 "Search results"] [:body {:style "font: 14pt/16pt helvetica; background-color: #F2FB78; padding-top:100px; text-align: center" } [:form {:method "post" :action "/"} (interleave (for [flick (flick-vec a)] (label :flick_name (:name flick))) (for [flick-name (flick-vec a)][:br]) (for [flick-image (flick-vec a)] [:img {:id "img_movie" :src (:image flick-image)}]) (for [flick-read-link (flick-vec a)] (link-to (:read-link flick-read-link) "Read it here!")) (for [flick (flick-vec a)] [:br]))]]))
(defn flick-vec [a] (vec (let [flick-url (create-flick-url a) flick-names (print-flick-name-content flick-url)] (mapper-gen3 flick-names (get-image-content flick-url) (get-all-reading-links flick-url) ))) )
(defn mapper-gen3 [names images read-link] (sort-by :name (map #(hash-map :name %1 :image %2 :read-link %3) names images read-link )))
(def url "http://www.rottentomatoes.com/") (defn get-page "Gets the html page from passed url" [url] (html/html-resource (java.net.URL. url))[:h3 :span :a])
(defn name+search "This function returns a sequence of h2 tags,where a.main is parsed from movieweb" [url] (html/select (get-page url) [:h3 (html/attr= :class "nomargin"):a]))
(defn image+search "Function that returns a sequence of tags, where img is image parsed from movieweb" [url] (html/select (get-page url) [:span (html/attr= :class "movieposter"):a]))
(defn print-flick-name-content [url] (vec (flatten (map :content (name+search url)))))
(defn get-image-content [url] (vec (flatten (map #(re-find #"http.*jpg" %) (map :style (map :attrs (image+search url)))))))
--
You received this message because you are subscribed to the Google Groups "Compojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to compojure+...@googlegroups.com.
To post to this group, send email to comp...@googlegroups.com.
Visit this group at http://groups.google.com/group/compojure.
For more options, visit https://groups.google.com/d/optout.
--