Scraping, paring, producing HTML

98 views
Skip to first unread message

Webdev Tory Anderson

unread,
Mar 19, 2016, 1:12:43 PM3/19/16
to Enlive
I'm trying to scrape a page, pare it down to a sub-portion of the page, and return the sub-portion as HTML. Is there a better way than the following?

(-> address URL. html/html-resource (html/select [:#main :#content]) html/emit* (->> (apply str)))

That seems almost right, but according to my REPL I have all quotation marks escaped, and lots of \n and \t, which won't translate to much in the HTML.

Christophe Grand

unread,
Mar 21, 2016, 8:52:59 AM3/21/16
to enlive-clj
From your description it's just the way the REPL prints value that troubles you.

You see something like "<html>\n\t<head>...". If you try to print this value (using println for example) you'll see that escaped quotation marks and \n and \t are just artifacts of the readable representation written out by the REPL and are not part of the value.


--
You received this message because you are subscribed to the Google Groups "Enlive" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enlive-clj+...@googlegroups.com.
To post to this group, send email to enliv...@googlegroups.com.
Visit this group at https://groups.google.com/group/enlive-clj.
For more options, visit https://groups.google.com/d/optout.



--
On Clojure http://clj-me.cgrand.net/
Clojure Programming http://clojurebook.com
Training, Consulting & Contracting http://lambdanext.eu/
Reply all
Reply to author
Forward
0 new messages