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 +4 -4
- data/Rakefile +1 -1
- data/lib/feedparser/builder/rss.rb +41 -17
- data/lib/feedparser/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98fe29b4b37ab3f10f52e1eb8b928807cf911f6e
|
4
|
+
data.tar.gz: ca67cc643a6c0219efe13dbf4bd99ccd76c359a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5fef03a0a3680af0d825c4169af41dbd16ebee7b68d8b34ef2548d12b7105d6748dc62b8e9fe3bf5be0513dbfe5530359c65b73ab0f8f83848364c8657587ed
|
7
|
+
data.tar.gz: 94a342686dc2b21e6fe9e0d963b08ab3d7c0701f4981e354d698818106e77eb1b7dfc46bf03164140aa03a0221af8ee6a6c31c846419c36e95a4dd96bce9c35b
|
data/Rakefile
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
82
|
-
|
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
|
-
|
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
|
-
|
181
|
-
|
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
|
data/lib/feedparser/version.rb
CHANGED
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.
|
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:
|
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:
|
116
|
+
version: '2.3'
|
117
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
119
|
- - ">="
|