This is a newbie question. I have a function that parse a web page and return a series of 5 elements. I then use the println
function to see if it worked correctly.
...
(defn select-first-index-page-elements [source element n]
((get-parsing-logic source "parsing-logic-index-page" element "final-touch-fn")
(nth
(html/select
(fetch-first-page source)
(get-parsing-logic source "parsing-logic-index-page" element "first-touch"))
n)))
(defn parsing-source [source]
(loop [n 0]
(when (< n (count-first-index-page-elements source "title"))
(println ; the group of elements:
(select-first-index-page-elements source "date" n)
" - "
(select-first-index-page-elements source "title" n)
" - "
(select-first-index-page-elements source "url" n)
"\n")
(recur (inc n)))))))
(parsing-source "events-directory-website")
Now, instead of a println
function, how could I store those elements into a DB? And how I can not store a given group of element if it is already in the db?
How can I print then only the new group of elements that the parsing function did find?