New scraping routines
This commit is contained in:
parent
200fb961b9
commit
68f5cce136
@ -1,6 +1,27 @@
|
|||||||
(ns com-jakewindle-git.scraper
|
(ns com-jakewindle-git.scraper
|
||||||
(:require [clj-http.client :as client]))
|
(:gen-class)
|
||||||
|
(:require [clj-http.client :as client]
|
||||||
|
[hickory.core :as hick]))
|
||||||
|
|
||||||
|
;; Models
|
||||||
|
|
||||||
|
;; Page
|
||||||
|
(defn page [html]
|
||||||
|
{:html html :parsed nil})
|
||||||
|
|
||||||
|
(defn get-src [uri]
|
||||||
|
(:body (client/get uri)))
|
||||||
|
|
||||||
|
(defn parse-src [src]
|
||||||
|
(hick/parse src))
|
||||||
|
|
||||||
|
(defn new-page [uri]
|
||||||
|
(-> uri
|
||||||
|
(get-src)
|
||||||
|
(parse-src)
|
||||||
|
(page)))
|
||||||
|
|
||||||
|
;; Entities
|
||||||
(defn greet
|
(defn greet
|
||||||
"Callable entry point to the application."
|
"Callable entry point to the application."
|
||||||
[data]
|
[data]
|
||||||
|
Loading…
Reference in New Issue
Block a user