Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 10c01a1b0b75c1eb489e899bf2bc00819bce26ee @ngrunwald committed Jul 27, 2010
Showing with 49 additions and 0 deletions.
  1. +17 −0 README
  2. +6 −0 project.clj
  3. +20 −0 src/clj_html_scrapper/core.clj
  4. +6 −0 test/clj_htmlunit/test/core.clj
17 README
@@ -0,0 +1,17 @@
+# clj-htmlunit
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## Installation
+
+FIXME: write
+
+## License
+
+Copyright (C) 2010 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.
6 project.clj
@@ -0,0 +1,6 @@
+(defproject clj-htmlunit "0.0.1-SNAPSHOT"
+ :description "FIXME: write"
+ :dependencies [[org.clojure/clojure "1.2.0-beta1"]
+ [org.clojure/clojure-contrib "1.2.0-beta1"]
+ [net.sourceforge.htmlunit/htmlunit "2.7"]]
+ :dev-dependencies [[swank-clojure "1.2.1"]])
20 src/clj_html_scrapper/core.clj
@@ -0,0 +1,20 @@
+(ns clj-htmlunit.core
+ (:import (com.gargoylesoftware.htmlunit WebClient)))
+
+(def *client* (new WebClient))
+
+(defn get-page
+ [url]
+ (.getPage *client* url))
+
+(defn get-nodes-by-xpath
+ [node xpath]
+ (.getByXPath node xpath))
+
+(defn get-node-anchors
+ [node]
+ (get-nodes-by-xpath node "//a"))
+
+(defn get-nodes-anchors
+ [nodes]
+ (flatten (map #(get-node-anchors %) nodes)))
6 test/clj_htmlunit/test/core.clj
@@ -0,0 +1,6 @@
+(ns clj-html-scrapper.test.core
+ (:use [clj-html-scrapper.core] :reload-all)
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false "No tests have been written."))

0 comments on commit 10c01a1

Please sign in to comment.