开发者

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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜