Created
June 28, 2013 09:08
-
-
Save seymores/5883478 to your computer and use it in GitHub Desktop.
Get Haze API index with different libraries in clojure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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