Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Enlive make screen scraping fun :)

View enlive-screen-scraping.clj
1 2 3 4 5 6 7 8 9 10
(ns screen-scraping
(:use [clojure.contrib.duck-streams :only [reader]]
[net.cgrand.enlive-html :only [html-resource select text]]))
 
(def url-to-scrape "http://www.domain.com/somewhere/index.php")
 
;; finds the text of the element with id="someId"
(defn scrape []
(let [html (-> url-to-scrape reader html-resource)]
(-> html (select [:#someid]) first text)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.