rickerbh-feedzirra 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +1 -1
- data/lib/feedzirra/itunes_rss.rb +46 -0
- data/lib/feedzirra/itunes_rss_item.rb +28 -0
- data/lib/feedzirra/itunes_rss_owner.rb +8 -0
- metadata +7 -1
data/README.textile
CHANGED
@@ -99,7 +99,7 @@ feeds = Feedzirra::Feed.fetch_and_parse(feeds_urls)
|
|
99
99
|
# there will be a Fixnum of the http response code instead of a feed object
|
100
100
|
|
101
101
|
# updating multiple feeds. it expects a collection of feed objects
|
102
|
-
updated_feeds = Feedzirra::Feed.
|
102
|
+
updated_feeds = Feedzirra::Feed.update(feeds.values)
|
103
103
|
|
104
104
|
# defining custom behavior on failure or success. note that a return status of 304 (not updated) will call the on_success handler
|
105
105
|
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing",
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Feedzirra
|
2
|
+
# iTunes is RSS 2.0 + some apple extensions
|
3
|
+
# Source: http://www.apple.com/itunes/whatson/podcasts/specs.html
|
4
|
+
class ITunesRSS
|
5
|
+
include SAXMachine
|
6
|
+
include FeedUtilities
|
7
|
+
|
8
|
+
attr_accessor :feed_url
|
9
|
+
|
10
|
+
# RSS 2.0 elements that need including
|
11
|
+
element :copyright
|
12
|
+
element :description
|
13
|
+
element :language
|
14
|
+
element :managingEditor
|
15
|
+
element :title
|
16
|
+
element :link, :as => :url
|
17
|
+
|
18
|
+
# If author is not present use managingEditor on the channel
|
19
|
+
element :"itunes:author", :as => :itunes_author
|
20
|
+
element :"itunes:block", :as => :itunes_block
|
21
|
+
element :"itunes:image", :value => :href, :as => :itunes_image
|
22
|
+
element :"itunes:explicit", :as => :itunes_explicit
|
23
|
+
element :"itunes:keywords", :as => :itunes_keywords
|
24
|
+
# New URL for the podcast feed
|
25
|
+
element :"itunes:new-feed-url", :as => :itunes_new_feed_url
|
26
|
+
element :"itunes:subtitle", :as => :itunes_subtitle
|
27
|
+
# If summary is not present, use the description tag
|
28
|
+
element :"itunes:summary", :as => :itunes_summary
|
29
|
+
|
30
|
+
# iTunes RSS feeds can have multiple main categories...
|
31
|
+
# ...and multiple sub-categories per category
|
32
|
+
# TODO subcategories not supported correctly - they are at the same level
|
33
|
+
# as the main categories
|
34
|
+
elements :"itunes:category", :as => :itunes_categories, :value => :text
|
35
|
+
|
36
|
+
elements :"itunes:owner", :as => :itunes_owners, :class => ITunesRSSOwner
|
37
|
+
|
38
|
+
elements :item, :as => :entries, :class => ITunesRSSItem
|
39
|
+
|
40
|
+
def self.able_to_parse?(xml)
|
41
|
+
xml =~ /xmlns:itunes=\"http:\/\/www.itunes.com\/dtds\/podcast-1.0.dtd\"/
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Feedzirra
|
2
|
+
# iTunes extensions to the standard RSS2.0 item
|
3
|
+
# Source: http://www.apple.com/itunes/whatson/podcasts/specs.html
|
4
|
+
class ITunesRSSItem
|
5
|
+
include SAXMachine
|
6
|
+
include FeedUtilities
|
7
|
+
element :author
|
8
|
+
element :guid
|
9
|
+
element :title
|
10
|
+
element :link, :as => :url
|
11
|
+
element :description, :as => :summary
|
12
|
+
element :pubDate, :as => :published
|
13
|
+
|
14
|
+
# If author is not present use author tag on the item
|
15
|
+
element :"itunes:author", :as => :itunes_author
|
16
|
+
element :"itunes:block", :as => :itunes_block
|
17
|
+
element :"itunes:duration", :as => :itunes_duration
|
18
|
+
element :"itunes:explicit", :as => :itunes_explicit
|
19
|
+
element :"itunes:keywords", :as => :itunes_keywords
|
20
|
+
element :"itunes:subtitle", :as => :itunes_subtitle
|
21
|
+
# If summary is not present, use the description tag
|
22
|
+
element :"itunes:summary", :as => :itunes_summary
|
23
|
+
element :enclosure, :value => :length, :as => :enclosure_length
|
24
|
+
element :enclosure, :value => :type, :as => :enclosure_type
|
25
|
+
element :enclosure, :value => :url, :as => :enclosure_url
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rickerbh-feedzirra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Dix
|
@@ -88,6 +88,9 @@ files:
|
|
88
88
|
- lib/feedzirra/atom_entry.rb
|
89
89
|
- lib/feedzirra/atom_feed_burner.rb
|
90
90
|
- lib/feedzirra/atom_feed_burner_entry.rb
|
91
|
+
- lib/feedzirra/itunes_rss.rb
|
92
|
+
- lib/feedzirra/itunes_rss_item.rb
|
93
|
+
- lib/feedzirra/itunes_rss_owner.rb
|
91
94
|
- lib/feedzirra/rdf.rb
|
92
95
|
- lib/feedzirra/rdf_entry.rb
|
93
96
|
- lib/feedzirra/rss.rb
|
@@ -103,6 +106,9 @@ files:
|
|
103
106
|
- spec/feedzirra/atom_entry_spec.rb
|
104
107
|
- spec/feedzirra/atom_feed_burner_spec.rb
|
105
108
|
- spec/feedzirra/atom_feed_burner_entry_spec.rb
|
109
|
+
- lib/feedzirra/itunes_rss_spec.rb
|
110
|
+
- lib/feedzirra/itunes_rss_item_spec.rb
|
111
|
+
- lib/feedzirra/itunes_rss_owner_spec.rb
|
106
112
|
- spec/feedzirra/rdf_spec.rb
|
107
113
|
- spec/feedzirra/rdf_entry_spec.rb
|
108
114
|
- spec/feedzirra/rss_spec.rb
|