rubylibre-feedzirra 0.0.14 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +169 -0
- data/README.textile +9 -0
- data/lib/feedzirra/feed.rb +32 -37
- data/lib/feedzirra/parser/atom.rb +9 -0
- data/lib/feedzirra/parser/atom_entry.rb +6 -0
- data/lib/feedzirra/parser/atom_feed_burner_entry.rb +1 -1
- data/lib/feedzirra/parser/itunes_category.rb +12 -0
- data/lib/feedzirra/parser/mrss_category.rb +11 -0
- data/lib/feedzirra/parser/mrss_content.rb +48 -0
- data/lib/feedzirra/parser/mrss_copyright.rb +10 -0
- data/lib/feedzirra/parser/mrss_credit.rb +11 -0
- data/lib/feedzirra/parser/mrss_group.rb +37 -0
- data/lib/feedzirra/parser/mrss_hash.rb +10 -0
- data/lib/feedzirra/parser/mrss_player.rb +11 -0
- data/lib/feedzirra/parser/mrss_rating.rb +10 -0
- data/lib/feedzirra/parser/mrss_restriction.rb +11 -0
- data/lib/feedzirra/parser/mrss_text.rb +13 -0
- data/lib/feedzirra/parser/mrss_thumbnail.rb +11 -0
- data/lib/feedzirra/parser/rss.rb +64 -9
- data/lib/feedzirra/parser/rss_entry.rb +54 -14
- data/lib/feedzirra/parser/rss_image.rb +15 -0
- data/lib/feedzirra.rb +17 -5
- data/spec/benchmarks/feed_benchmarks.rb +98 -0
- data/spec/benchmarks/feedzirra_benchmarks.rb +40 -0
- data/spec/benchmarks/fetching_benchmarks.rb +28 -0
- data/spec/benchmarks/parsing_benchmark.rb +30 -0
- data/spec/benchmarks/updating_benchmarks.rb +33 -0
- data/spec/feedzirra/feed_spec.rb +35 -53
- data/spec/feedzirra/parser/atom_entry_spec.rb +4 -0
- data/spec/feedzirra/parser/atom_spec.rb +8 -0
- data/spec/feedzirra/parser/mrss_content_spec.rb +32 -0
- data/spec/feedzirra/parser/rss_entry_spec.rb +121 -8
- data/spec/feedzirra/parser/rss_spec.rb +66 -14
- data/spec/sample_feeds/run_against_sample.rb +20 -0
- data/spec/spec_helper.rb +3 -3
- metadata +37 -22
- data/lib/feedzirra/parser/itunes_rss.rb +0 -50
- data/lib/feedzirra/parser/itunes_rss_item.rb +0 -31
- data/lib/feedzirra/parser/itunes_rss_owner.rb +0 -12
- data/spec/feedzirra/parser/itunes_rss_item_spec.rb +0 -48
- data/spec/feedzirra/parser/itunes_rss_owner_spec.rb +0 -18
- data/spec/feedzirra/parser/itunes_rss_spec.rb +0 -50
- data/spec/spec.opts +0 -2
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubylibre-feedzirra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Dix
|
@@ -81,39 +81,54 @@ extensions: []
|
|
81
81
|
extra_rdoc_files: []
|
82
82
|
|
83
83
|
files:
|
84
|
-
- lib/core_ext/date.rb
|
85
|
-
- lib/core_ext/string.rb
|
86
84
|
- lib/feedzirra.rb
|
87
85
|
- lib/feedzirra/feed.rb
|
88
|
-
- lib/feedzirra/
|
89
|
-
- lib/feedzirra/parser/
|
86
|
+
- lib/feedzirra/feed_utilities.rb
|
87
|
+
- lib/feedzirra/parser/rss_entry.rb
|
90
88
|
- lib/feedzirra/parser/atom_feed_burner.rb
|
91
|
-
- lib/feedzirra/parser/
|
92
|
-
- lib/feedzirra/parser/
|
93
|
-
- lib/feedzirra/parser/itunes_rss_item.rb
|
94
|
-
- lib/feedzirra/parser/itunes_rss_owner.rb
|
89
|
+
- lib/feedzirra/parser/mrss_hash.rb
|
90
|
+
- lib/feedzirra/parser/atom_entry.rb
|
95
91
|
- lib/feedzirra/parser/rss.rb
|
96
|
-
- lib/feedzirra/parser/
|
97
|
-
- lib/feedzirra/
|
92
|
+
- lib/feedzirra/parser/mrss_rating.rb
|
93
|
+
- lib/feedzirra/parser/mrss_text.rb
|
94
|
+
- lib/feedzirra/parser/mrss_player.rb
|
95
|
+
- lib/feedzirra/parser/mrss_group.rb
|
96
|
+
- lib/feedzirra/parser/rss_image.rb
|
97
|
+
- lib/feedzirra/parser/atom.rb
|
98
|
+
- lib/feedzirra/parser/atom_feed_burner_entry.rb
|
99
|
+
- lib/feedzirra/parser/mrss_thumbnail.rb
|
100
|
+
- lib/feedzirra/parser/mrss_credit.rb
|
101
|
+
- lib/feedzirra/parser/itunes_category.rb
|
102
|
+
- lib/feedzirra/parser/mrss_restriction.rb
|
103
|
+
- lib/feedzirra/parser/mrss_category.rb
|
104
|
+
- lib/feedzirra/parser/mrss_content.rb
|
105
|
+
- lib/feedzirra/parser/mrss_copyright.rb
|
98
106
|
- lib/feedzirra/feed_entry_utilities.rb
|
107
|
+
- lib/core_ext/date.rb
|
108
|
+
- lib/core_ext/string.rb
|
109
|
+
- README.rdoc
|
99
110
|
- README.textile
|
100
111
|
- Rakefile
|
101
|
-
- spec/
|
102
|
-
- spec/
|
103
|
-
- spec/feedzirra/
|
112
|
+
- spec/feedzirra/parser/mrss_content_spec.rb
|
113
|
+
- spec/feedzirra/parser/rss_entry_spec.rb
|
114
|
+
- spec/feedzirra/parser/atom_feed_burner_entry_spec.rb
|
115
|
+
- spec/feedzirra/parser/rss_spec.rb
|
104
116
|
- spec/feedzirra/parser/atom_spec.rb
|
105
117
|
- spec/feedzirra/parser/atom_entry_spec.rb
|
106
118
|
- spec/feedzirra/parser/atom_feed_burner_spec.rb
|
107
|
-
- spec/feedzirra/parser/atom_feed_burner_entry_spec.rb
|
108
|
-
- spec/feedzirra/parser/itunes_rss_spec.rb
|
109
|
-
- spec/feedzirra/parser/itunes_rss_item_spec.rb
|
110
|
-
- spec/feedzirra/parser/itunes_rss_owner_spec.rb
|
111
|
-
- spec/feedzirra/parser/rss_spec.rb
|
112
|
-
- spec/feedzirra/parser/rss_entry_spec.rb
|
113
|
-
- spec/feedzirra/feed_utilities_spec.rb
|
114
119
|
- spec/feedzirra/feed_entry_utilities_spec.rb
|
120
|
+
- spec/feedzirra/feed_spec.rb
|
121
|
+
- spec/feedzirra/feed_utilities_spec.rb
|
122
|
+
- spec/benchmarks/feed_benchmarks.rb
|
123
|
+
- spec/benchmarks/updating_benchmarks.rb
|
124
|
+
- spec/benchmarks/feedzirra_benchmarks.rb
|
125
|
+
- spec/benchmarks/fetching_benchmarks.rb
|
126
|
+
- spec/benchmarks/parsing_benchmark.rb
|
127
|
+
- spec/sample_feeds/run_against_sample.rb
|
128
|
+
- spec/spec_helper.rb
|
115
129
|
has_rdoc: true
|
116
130
|
homepage: http://github.com/pauldix/feedzirra
|
131
|
+
licenses:
|
117
132
|
post_install_message:
|
118
133
|
rdoc_options: []
|
119
134
|
|
@@ -134,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
149
|
requirements: []
|
135
150
|
|
136
151
|
rubyforge_project:
|
137
|
-
rubygems_version: 1.
|
152
|
+
rubygems_version: 1.3.5
|
138
153
|
signing_key:
|
139
154
|
specification_version: 2
|
140
155
|
summary: "A feed fetching and parsing library that treats the internet like Godzilla treats Japan: it dominates and eats all."
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Feedzirra
|
2
|
-
|
3
|
-
module Parser
|
4
|
-
# iTunes is RSS 2.0 + some apple extensions
|
5
|
-
# Source: http://www.apple.com/itunes/whatson/podcasts/specs.html
|
6
|
-
class ITunesRSS
|
7
|
-
include SAXMachine
|
8
|
-
include FeedUtilities
|
9
|
-
|
10
|
-
attr_accessor :feed_url
|
11
|
-
|
12
|
-
# RSS 2.0 elements that need including
|
13
|
-
element :copyright
|
14
|
-
element :description
|
15
|
-
element :language
|
16
|
-
element :managingEditor
|
17
|
-
element :title
|
18
|
-
element :link, :as => :url
|
19
|
-
|
20
|
-
# If author is not present use managingEditor on the channel
|
21
|
-
element :"itunes:author", :as => :itunes_author
|
22
|
-
element :"itunes:block", :as => :itunes_block
|
23
|
-
element :"itunes:image", :value => :href, :as => :itunes_image
|
24
|
-
element :"itunes:explicit", :as => :itunes_explicit
|
25
|
-
element :"itunes:keywords", :as => :itunes_keywords
|
26
|
-
# New URL for the podcast feed
|
27
|
-
element :"itunes:new-feed-url", :as => :itunes_new_feed_url
|
28
|
-
element :"itunes:subtitle", :as => :itunes_subtitle
|
29
|
-
# If summary is not present, use the description tag
|
30
|
-
element :"itunes:summary", :as => :itunes_summary
|
31
|
-
|
32
|
-
# iTunes RSS feeds can have multiple main categories...
|
33
|
-
# ...and multiple sub-categories per category
|
34
|
-
# TODO subcategories not supported correctly - they are at the same level
|
35
|
-
# as the main categories
|
36
|
-
elements :"itunes:category", :as => :itunes_categories, :value => :text
|
37
|
-
|
38
|
-
elements :"itunes:owner", :as => :itunes_owners, :class => ITunesRSSOwner
|
39
|
-
|
40
|
-
elements :item, :as => :entries, :class => ITunesRSSItem
|
41
|
-
|
42
|
-
def self.able_to_parse?(xml)
|
43
|
-
xml =~ /xmlns:itunes=\"http:\/\/www.itunes.com\/dtds\/podcast-1.0.dtd\"/
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Feedzirra
|
2
|
-
|
3
|
-
module Parser
|
4
|
-
# iTunes extensions to the standard RSS2.0 item
|
5
|
-
# Source: http://www.apple.com/itunes/whatson/podcasts/specs.html
|
6
|
-
class ITunesRSSItem
|
7
|
-
include SAXMachine
|
8
|
-
include FeedUtilities
|
9
|
-
element :author
|
10
|
-
element :guid
|
11
|
-
element :title
|
12
|
-
element :link, :as => :url
|
13
|
-
element :description, :as => :summary
|
14
|
-
element :pubDate, :as => :published
|
15
|
-
|
16
|
-
# If author is not present use author tag on the item
|
17
|
-
element :"itunes:author", :as => :itunes_author
|
18
|
-
element :"itunes:block", :as => :itunes_block
|
19
|
-
element :"itunes:duration", :as => :itunes_duration
|
20
|
-
element :"itunes:explicit", :as => :itunes_explicit
|
21
|
-
element :"itunes:keywords", :as => :itunes_keywords
|
22
|
-
element :"itunes:subtitle", :as => :itunes_subtitle
|
23
|
-
# If summary is not present, use the description tag
|
24
|
-
element :"itunes:summary", :as => :itunes_summary
|
25
|
-
element :enclosure, :value => :length, :as => :enclosure_length
|
26
|
-
element :enclosure, :value => :type, :as => :enclosure_type
|
27
|
-
element :enclosure, :value => :url, :as => :enclosure_url
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
|
-
|
3
|
-
describe Feedzirra::Parser::ITunesRSSItem do
|
4
|
-
before(:each) do
|
5
|
-
# I don't really like doing it this way because these unit test should only rely on ITunesRssItem,
|
6
|
-
# but this is actually how it should work. You would never just pass entry xml straight to the ITunesRssItem
|
7
|
-
@item = Feedzirra::Parser::ITunesRSS.parse(sample_itunes_feed).entries.first
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should parse the title" do
|
11
|
-
@item.title.should == "Shake Shake Shake Your Spices"
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should parse the author" do
|
15
|
-
@item.itunes_author.should == "John Doe"
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should parse the subtitle" do
|
19
|
-
@item.itunes_subtitle.should == "A short primer on table spices"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should parse the summary" do
|
23
|
-
@item.itunes_summary.should == "This week we talk about salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should parse the enclosure" do
|
27
|
-
@item.enclosure_length.should == "8727310"
|
28
|
-
@item.enclosure_type.should == "audio/x-m4a"
|
29
|
-
@item.enclosure_url.should == "http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a"
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should parse the guid" do
|
33
|
-
@item.guid.should == "http://example.com/podcasts/archive/aae20050615.m4a"
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should parse the published date" do
|
37
|
-
@item.published.should == "Wed, 15 Jun 2005 19:00:00 GMT"
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should parse the duration" do
|
41
|
-
@item.itunes_duration.should == "7:04"
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should parse the keywords" do
|
45
|
-
@item.itunes_keywords.should == "salt, pepper, shaker, exciting"
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
|
-
|
3
|
-
describe Feedzirra::Parser::ITunesRSSOwner do
|
4
|
-
before(:each) do
|
5
|
-
# I don't really like doing it this way because these unit test should only rely on RSSEntry,
|
6
|
-
# but this is actually how it should work. You would never just pass entry xml straight to the ITunesRssOwner
|
7
|
-
@owner = Feedzirra::Parser::ITunesRSS.parse(sample_itunes_feed).itunes_owners.first
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should parse the name" do
|
11
|
-
@owner.name.should == "John Doe"
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should parse the email" do
|
15
|
-
@owner.email.should == "john.doe@example.com"
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
2
|
-
|
3
|
-
describe Feedzirra::Parser::ITunesRSS do
|
4
|
-
describe "#will_parse?" do
|
5
|
-
it "should return true for an itunes RSS feed" do
|
6
|
-
Feedzirra::Parser::ITunesRSS.should be_able_to_parse(sample_itunes_feed)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should return fase for an atom feed" do
|
10
|
-
Feedzirra::Parser::ITunesRSS.should_not be_able_to_parse(sample_atom_feed)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "parsing" do
|
15
|
-
before(:each) do
|
16
|
-
@feed = Feedzirra::Parser::ITunesRSS.parse(sample_itunes_feed)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should parse the subtitle" do
|
20
|
-
@feed.itunes_subtitle.should == "A show about everything"
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should parse the author" do
|
24
|
-
@feed.itunes_author.should == "John Doe"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should parse an owner" do
|
28
|
-
@feed.itunes_owners.size.should == 1
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should parse an image" do
|
32
|
-
@feed.itunes_image.should == "http://example.com/podcasts/everything/AllAboutEverything.jpg"
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should parse categories" do
|
36
|
-
@feed.itunes_categories.size == 3
|
37
|
-
@feed.itunes_categories[0] == "Technology"
|
38
|
-
@feed.itunes_categories[1] == "Gadgets"
|
39
|
-
@feed.itunes_categories[2] == "TV & Film"
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should parse the summary" do
|
43
|
-
@feed.itunes_summary.should == "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store"
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should parse entries" do
|
47
|
-
@feed.entries.size.should == 3
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/spec/spec.opts
DELETED