1
- feedparser-clj
1
+ feedparser-clj [ ![ Build Status ] ( https://travis-ci.org/Gonzih/feedparser-clj.svg?branch=master )] ( https://travis-ci.org/Gonzih/feedparser-clj )
2
2
==============
3
3
4
4
Parse RSS/Atom feeds with a simple, clojure-friendly API.
@@ -33,9 +33,9 @@ The following REPL session should give an idea about the capabilities and usage
33
33
34
34
Load the package into your namespace:
35
35
36
- user=> (ns user (:use feedparser-clj.core) (:require [clojure.contrib .string :as string]))
36
+ user=> (ns user (:require [ feedparser-clj.core] [clojure.string :as string]))
37
37
38
- Retrieve and parse a feed:
38
+ Retrieve and parse a feed:
39
39
40
40
user=> (def f (parse-feed "http://gregheartsfield.com/atom.xml"))
41
41
@@ -55,7 +55,7 @@ Retrieve and parse a feed:
55
55
` f ` is now a map that can be accessed by key to retrieve feed information:
56
56
57
57
user=> (keys f)
58
- (:authors :categories :contributors :copyright :description :encoding :entries :feed-type :image :language :link :entry-links :published-date :title :uri)
58
+ (:authors :author : categories :contributors :copyright :description :encoding :entries :feed-type :image :language :link :entry-links :published-date :title :uri)
59
59
60
60
A key applied to the feed gives the value, or nil if it was not defined for the feed.
61
61
@@ -92,10 +92,10 @@ Find the most recently updated entry's title:
92
92
user=> (first (map :title (reverse (sort-by :updated-date (:entries f)))))
93
93
"Version Control Diagrams with TikZ"
94
94
95
- Compute what percentage of entries have the word "haskell" in the body (uses ` clojure.contrib. string ` ):
95
+ Compute what percentage of entries have the word "haskell" in the body (uses ` clojure.string ` ):
96
96
97
- user=> (let [es (:entries f)]
98
- (* 100.0 (/ (count (filter #(string/substring? "haskell"
97
+ user=> (let [es (:entries f)]
98
+ (* 100.0 (/ (count (filter #(string/substring? "haskell"
99
99
(:value (first (:contents %)))) es))
100
100
(count es))))
101
101
55.55555555555556
@@ -117,4 +117,4 @@ Distributed under the BSD-3 License.
117
117
Copyright
118
118
---------
119
119
120
- Copyright (C) 2010 Greg Heartsfield
120
+ Copyright (C) 2010 Greg Heartsfield
0 commit comments