clojure-soup
clojure-soup copied to clipboard
'$' Macro not working unless using literals
I tried crawling a page with clojure-soup the following way:
(defn get-offers
"Returns the current offers from the page"
[]
(let [uri "https://google.com"
selector "input" ]
($ (get! uri) selector)))
It returned zero entries. It only was successful after changing it to this:
(defn get-offers
"Returns the current offers from the page"
[]
(let [uri "https://google.com"]
($ (get! uri) "input")))
It seems that the macros behavior changes due to the type of the parameter, and the evaluation fails when you do not declare it as a string literal? Right now, I am working around it with following code:
(defn get-offers
"Returns the current offers from the page"
[]
(let [uri "https://google.com"
selector "input" ]
(.select (get! uri) selector)))