这是一个新手问题。我有一个解析网页并返回一系列 5 个元素的函数。然后我使用该println
功能查看它是否正常工作。
...
(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")
println
现在,我如何将这些元素存储到数据库中,而不是函数?如果它已经在数据库中,我如何不能存储给定的一组元素?我怎样才能只打印解析函数确实找到的新元素组?