Skip to content

Instantly share code, notes, and snippets.

@seymores
Created June 28, 2013 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seymores/5883478 to your computer and use it in GitHub Desktop.
Save seymores/5883478 to your computer and use it in GitHub Desktop.
Get Haze API index with different libraries in clojure.
(ns haze-api.core
(:require [net.cgrand.enlive-html :as html])
(:gen-class))
(def doe-url "http://apims.doe.gov.my/apims/hourly2.php")
(defn rows-by-enlive
[url]
(let [site (html/html-resource (java.net.URL. url))
rows (html/select site [:table.table1 :tr])]
rows))
(defn rows-by-jsoup
[url]
(let [site (.get (org.jsoup.Jsoup/connect url))
rows (.select site "table.table1 tr")]
rows))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment