Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing snippets of html with enlive

Why does the following snippet does not work?

(html/select (:body (client/post "http://www.web.onpe.gob.pe/modElecciones/elecciones/elecciones2011/2davuelta/onpe/presidente/extras/provincias.php" {:form-params {"elegido" "010000"}})) [:option])

Do I have to do something with the html-string to turn it into a clojure datastructure first or something like that?

like image 302
PuercoPop Avatar asked Jul 25 '13 20:07

PuercoPop


1 Answers

Yep - you can use html/html-snippet to turn a raw html string into something enlive can use, or html/html-resource to use an entire html file.

Try the following:

(html/select 
  (html/html-snippet 
    (:body (client/post "<your-website>" {:form-params {"elegido" "010000"}})) 
  [:option])
like image 111
Daniel Neal Avatar answered Nov 12 '22 13:11

Daniel Neal