feedparser 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1bacd6aeb6281e16cbcd51fd6732f999d9788cd
4
- data.tar.gz: c48df4d0c5cf710d63ec4ebabfc2e28a11b06d27
3
+ metadata.gz: 98fe29b4b37ab3f10f52e1eb8b928807cf911f6e
4
+ data.tar.gz: ca67cc643a6c0219efe13dbf4bd99ccd76c359a0
5
5
  SHA512:
6
- metadata.gz: 37d3ede519e5f9e3ef3d6a5c768181408ce049e19629af277440888fd96a35890a87c7ddffe11376de4b0acb4818820f7486f8ed7411ce91a24a11229af1acb9
7
- data.tar.gz: 6f448cc771f30d523b23337225b8bf26b0cf613be26236e7c68093e0ca8e5538f8e053ba0c84b8c58a2fbe95d3c9287fe3e90341f8ec4c4bedd8de203cb56a6a
6
+ metadata.gz: e5fef03a0a3680af0d825c4169af41dbd16ebee7b68d8b34ef2548d12b7105d6748dc62b8e9fe3bf5be0513dbfe5530359c65b73ab0f8f83848364c8657587ed
7
+ data.tar.gz: 94a342686dc2b21e6fe9e0d963b08ab3d7c0701f4981e354d698818106e77eb1b7dfc46bf03164140aa03a0221af8ee6a6c31c846419c36e95a4dd96bce9c35b
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ Hoe.spec 'feedparser' do
27
27
  self.licenses = ['Public Domain']
28
28
 
29
29
  self.spec_extras = {
30
- required_ruby_version: '>= 1.9.2'
30
+ required_ruby_version: '>= 2.3'
31
31
  }
32
32
 
33
33
  end
@@ -35,22 +35,34 @@ class RssFeedBuilder
35
35
  feed.summary = handle_content( rss_feed.channel.description, 'feed.description => summary' ) # required
36
36
  feed.url = rss_feed.channel.link # required
37
37
 
38
- feed.updated_local = handle_date( rss_feed.channel.lastBuildDate, 'feed.lastBuildDate => updated' ) # optional
38
+ begin
39
+ feed.updated_local = handle_date( rss_feed.channel.lastBuildDate, 'feed.lastBuildDate => updated' ) # optional
40
+ rescue
41
+ end
39
42
  feed.updated = feed.updated_local.utc if feed.updated_local
40
43
 
41
- feed.published_local = handle_date( rss_feed.channel.pubDate, 'feed.pubDate => published' ) # optional
44
+ begin
45
+ feed.published_local = handle_date( rss_feed.channel.pubDate, 'feed.pubDate => published' ) # optional
46
+ rescue
47
+ end
42
48
  feed.published = feed.published_local.utc if feed.published_local
43
49
 
44
- logger.debug " rss | feed.generator >#{rss_feed.channel.generator}< : #{rss_feed.channel.generator.class.name}"
50
+ begin
51
+ logger.debug " rss | feed.generator >#{rss_feed.channel.generator}< : #{rss_feed.channel.generator.class.name}"
52
+ rescue
53
+ end
45
54
 
46
- feed.generator.text = rss_feed.channel.generator # optional
55
+ begin
56
+ feed.generator.text = rss_feed.channel.generator # optional
57
+ rescue
58
+ end
47
59
  feed.generator.name = feed.generator.text ## note: for now set also name/title to "unparsed" (content) line (may change in the future!!!)
48
60
 
49
61
 
50
62
 
51
63
  ## check for managingEditor and/or webMaster
52
64
 
53
- if rss_feed.channel.managingEditor
65
+ if rss_feed.channel.respond_to?(:managingEditor) && rss_feed.channel.managingEditor
54
66
  author = Author.new
55
67
  author.text = rss_feed.channel.managingEditor.strip
56
68
  author.name = author.text ## note: for now use "unparsed" (content) line also for name
@@ -58,7 +70,7 @@ class RssFeedBuilder
58
70
  end
59
71
 
60
72
  ## todo/check - if tag is called webmaster or webMaster ???
61
- if rss_feed.channel.webMaster
73
+ if rss_feed.channel.respond_to?(:webMaster) && rss_feed.channel.webMaster
62
74
  author = Author.new
63
75
  author.text = rss_feed.channel.webMaster.strip
64
76
  author.name = author.text ## note: for now use "unparsed" (content) line also for name
@@ -77,9 +89,10 @@ class RssFeedBuilder
77
89
 
78
90
 
79
91
  ### check for categories (tags)
80
-
81
- rss_feed.channel.categories.each do |rss_cat|
82
- feed.tags << build_tag( rss_cat )
92
+ if rss_feed.channel.respond_to?(:categories)
93
+ rss_feed.channel.categories.each do |rss_cat|
94
+ feed.tags << build_tag( rss_cat )
95
+ end
83
96
  end
84
97
 
85
98
 
@@ -139,8 +152,10 @@ class RssFeedBuilder
139
152
  item.content = rss_item.content_encoded
140
153
  logger.debug " rss | item.content_encoded[0..40] >#{rss_item.content_encoded ? rss_item.content_encoded[0..40] : ''}< : #{rss_item.content_encoded.class.name}"
141
154
 
142
-
143
- item.published_local = handle_date( rss_item.pubDate, 'item.pubDate => published' )
155
+ begin
156
+ item.published_local = handle_date( rss_item.pubDate, 'item.pubDate => published' )
157
+ rescue
158
+ end
144
159
  item.published = item.published_local.utc if item.published_local
145
160
 
146
161
 
@@ -148,7 +163,7 @@ class RssFeedBuilder
148
163
  ##
149
164
  ## might be the case e.g. check lambda-the-ultimate.org, for example
150
165
 
151
- if rss_item.guid && rss_item.guid.content
166
+ if rss_item.respond_to?(:guid) && rss_item.guid && rss_item.guid.content
152
167
  item.guid = rss_item.guid.content
153
168
  logger.debug " rss | item.guid.content >#{rss_item.guid.content}< : #{rss_item.guid.content.class.name}"
154
169
  else
@@ -157,7 +172,7 @@ class RssFeedBuilder
157
172
  end
158
173
 
159
174
 
160
- if rss_item.author
175
+ if rss_item.respond_to?(:author) && rss_item.author
161
176
  author = Author.new
162
177
  author.text = rss_item.author.strip
163
178
  author.name = author.text ## note: for now use "unparsed" (content) line also for name
@@ -174,18 +189,27 @@ class RssFeedBuilder
174
189
  item.authors = authors
175
190
  end
176
191
 
192
+ unless item.published_local
193
+ # use dc_date only of no regular item date was given
194
+ begin
195
+ item.published_local = handle_date( rss_item.dc_date, 'item.dc_date => published' )
196
+ rescue
197
+ end
198
+ item.published = item.published_local.utc if item.published_local
199
+ end
177
200
 
178
201
  ### check for categories (tags)
179
-
180
- rss_item.categories.each do |rss_cat|
181
- item.tags << build_tag( rss_cat )
202
+ if rss_item.respond_to?(:categories)
203
+ rss_item.categories.each do |rss_cat|
204
+ item.tags << build_tag( rss_cat )
205
+ end
182
206
  end
183
207
 
184
208
 
185
209
  ## check for enclosure
186
210
  ## todo/check: rss can only include at most one enclosure?
187
211
 
188
- if rss_item.enclosure
212
+ if rss_item.respond_to?(:enclosure) && rss_item.enclosure
189
213
  attachment = Attachment.new
190
214
  attachment.url = rss_item.enclosure.url
191
215
  attachment.length = rss_item.enclosure.length
@@ -4,7 +4,7 @@ module FeedParser
4
4
 
5
5
  MAJOR = 2
6
6
  MINOR = 1
7
- PATCH = 0
7
+ PATCH = 1
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logutils
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: 1.9.2
116
+ version: '2.3'
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
119
  - - ">="