Removing markup when working with enlive
I'm learning to use the fantastic enlive library to do some web-scraping. I need to capture some text that may be partially highlighted. For example the html may look like:
<a href="example.com" class="usefulLink"><font color="#CC0000">Foo</font> <font color="#CC0000">Bar</font> &开发者_JS百科lt;font color="#CC0000">Baz</font> <font color="#CC0000">Blah</font>rest of text</a>
The result when using (select page [:a.usefulLink]) is a lot of {:tag :font :attrs {...} :content {...}}
My question is: is there an easy way to just fish out the :content stuff without all the other unnecessary stuff, or do I need to do it myself?
You can use unwrap
.
(-> page
(select [:a.usefulLink])
(at [:font] unwrap))
精彩评论