This is what I did:
(let [nodes (html/html-resource (StringReader. body))
meta-extractor (fn [m attr] (first (filter #(= (->
% :attrs :name) attr) m)))
metas (html/select nodes [:meta])
title (-> (meta-extractor metas "title") :attrs :content)
desc (-> (meta-extractor metas "description") :attrs :content)
date-raw (-> (meta-extractor metas "date") :attrs :content)
keywords-raw (-> (meta-extractor metas
"keywords") :attrs :content)
keywords (string/split keywords-raw #", ")]
Hope it helps.
On May 5, 5:18 am, Alfredo <[email protected]> wrote:
> Ty very much :)
> Alfredo
>
> On May 5, 10:05 am, Thorsten Wilms <[email protected]> wrote:
>
>
>
>
>
>
>
> > On 05/04/2011 06:23 PM, Alfredo wrote:
>
> > > <meta name="keywords" content="clojure, is, good" />
>
> > > I want to extract only the content part.
>
> > I recently had related issues, so:
>
> > (def metas
> > (en/html-snippet
> > "<meta http-equiv=\"Content-Type\" content=\"text/html;
> > charset=UTF-8\" />
> > <meta name=\"keywords\" content=\"clojure, is, good\" />"))
>
> > (en/select metas [[:meta (en/attr= :name "keywords")]])
>
> > (-> (en/select metas [[:meta (en/attr= :name "keywords")]])
> > first :attrs :content)
>
> > --
> > Thorsten Wilms
>
> > thorwil's design for free software:http://thorwil.wordpress.com/
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en