rrsimple-rss 1.3.7 → 1.3.8
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/lib/rrsimple-rss.rb +7 -6
- data/rrsimple-rss.gemspec +1 -1
- data/test/base/base_test.rb +3 -2
- metadata +11 -9
- checksums.yaml +0 -15
data/lib/rrsimple-rss.rb
CHANGED
@@ -2,14 +2,14 @@ require 'cgi'
|
|
2
2
|
require 'time'
|
3
3
|
|
4
4
|
class RRSimpleRSS
|
5
|
-
VERSION = "1.3.
|
5
|
+
VERSION = "1.3.8"
|
6
6
|
|
7
7
|
attr_reader :items, :source
|
8
8
|
alias :entries :items
|
9
9
|
|
10
10
|
@@feed_tags = [
|
11
11
|
:id,
|
12
|
-
:title, :subtitle, :link,
|
12
|
+
:title, :subtitle, :link, :linkbbc,
|
13
13
|
:description,
|
14
14
|
:author, :webMaster, :managingEditor, :contributor,
|
15
15
|
:pubDate, :lastBuildDate, :updated, :'dc:date', :'dc:subject',
|
@@ -23,7 +23,7 @@ class RRSimpleRSS
|
|
23
23
|
|
24
24
|
@@item_tags = [
|
25
25
|
:id,
|
26
|
-
:title, :link, :'link+alternate', :'link+self', :'link+edit', :'link+replies',
|
26
|
+
:title, :link, :linkbbc, :'link+alternate', :'link+self', :'link+edit', :'link+replies',
|
27
27
|
:author, :contributor,
|
28
28
|
:description, :summary, :content, :'content:encoded', :comments,
|
29
29
|
:pubDate, :published, :updated, :expirationDate, :modified, :'dc:date', :'dc:subject',
|
@@ -133,6 +133,10 @@ class RRSimpleRSS
|
|
133
133
|
item[tag] = match[3].scan(%r{<(rss:|atom:)?#{tag}(.*?)>(.*?)</(rss:|atom:)?#{tag}>}mi).map {|x| category(x[2])}
|
134
134
|
elsif tag == :keywords
|
135
135
|
item[tag] = match[3].scan(%r{<(rss:|atom:)?dc:subject rdf:type="keywords"(.*?)>(.*?)<\/(rss:|atom:)?dc:subject>}mi).map {|x| x[2].gsub(";", ",") }
|
136
|
+
elsif tag == :linkbbc
|
137
|
+
match[3] =~ %r{<(rss:|atom:)?link(.*?)/\s*>}mi
|
138
|
+
$2 =~ %r{href=(.*?)rel}
|
139
|
+
item[tag] = $1.nil? ? nil : $1[1..$1.length-3]
|
136
140
|
else
|
137
141
|
item[clean_tag(tag)] = clean_content(tag, $2, $3) if $2 || $3
|
138
142
|
end
|
@@ -160,9 +164,6 @@ class RRSimpleRSS
|
|
160
164
|
unescape(content.gsub(/<.*?>/,''))
|
161
165
|
when :"full-text"
|
162
166
|
CGI.unescapeHTML unescape(content.gsub(/<.*?>/,'')).force_encoding("UTF-8")
|
163
|
-
when :link
|
164
|
-
"#{attrs} " =~ /href=['"]?([^'"]*)['" ]/mi
|
165
|
-
$1
|
166
167
|
else
|
167
168
|
content.empty? && "#{attrs} " =~ /href=['"]?([^'"]*)['" ]/mi ? $1.strip : unescape(content)
|
168
169
|
end
|
data/rrsimple-rss.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "rrsimple-rss"
|
3
|
-
s.version = "1.3.
|
3
|
+
s.version = "1.3.8"
|
4
4
|
s.date = Time.now.strftime("%Y-%m-%d")
|
5
5
|
s.summary = "A simple, flexible, extensible, and liberal RSS and Atom reader for Ruby. It is designed to be backwards compatible with the standard RSS parser, but will never do RSS generation."
|
6
6
|
s.email = "rodrigo@rrmartins.com"
|
data/test/base/base_test.rb
CHANGED
@@ -80,13 +80,14 @@ class BaseTest < Test::Unit::TestCase
|
|
80
80
|
assert_equal 3, @rss_bbc2.items.size
|
81
81
|
assert_equal "BBCBrasil.com | Notícias", @rss_bbc2.title.force_encoding("UTF-8")
|
82
82
|
assert_equal "http://www.bbc.com/portuguese/full_all.xml", @rss_bbc2.channel.link
|
83
|
-
assert_equal "http://www.bbc.com/portuguese/noticias/2015/11/151109_catacumbas_paris_brasileiro_cc", @rss_bbc2.items.first.
|
84
|
-
assert_equal "http://www.bbc.com/portuguese/noticias/2015/11/151109_catacumbas_paris_brasileiro_cc", @rss_bbc2.items.first[:
|
83
|
+
assert_equal "http://www.bbc.com/portuguese/noticias/2015/11/151109_catacumbas_paris_brasileiro_cc", @rss_bbc2.items.first.linkbbc
|
84
|
+
assert_equal "http://www.bbc.com/portuguese/noticias/2015/11/151109_catacumbas_paris_brasileiro_cc", @rss_bbc2.items.first[:linkbbc]
|
85
85
|
assert_equal Time.parse("2015-11-09 16:40:33 -0200"), @rss_bbc2.items.first.updated
|
86
86
|
assert_equal Time.parse("2015-11-09 13:29:35 -0200"), @rss_bbc2.channel.updated
|
87
87
|
assert_not_nil @rss_bbc2.items.first.content
|
88
88
|
assert_nil @rss_bbc2.items.first.category.first
|
89
89
|
assert_kind_of Array, @rss_bbc2.items.first.keywords
|
90
|
+
assert_equal "internacional", @rss_bbc2.items.first.keywords[0].split(", ").first
|
90
91
|
end
|
91
92
|
|
92
93
|
def test_rss09
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rrsimple-rss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Lucas Carlson
|
@@ -9,7 +10,7 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2015-11-
|
13
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
13
14
|
dependencies: []
|
14
15
|
description: A simple, flexible, extensible, and liberal RSS and Atom reader for Ruby.
|
15
16
|
It is designed to be backwards compatible with the standard RSS parser, but will
|
@@ -19,41 +20,42 @@ executables: []
|
|
19
20
|
extensions: []
|
20
21
|
extra_rdoc_files: []
|
21
22
|
files:
|
22
|
-
- LICENSE
|
23
|
-
- README.markdown
|
24
|
-
- Rakefile
|
25
23
|
- install.rb
|
26
24
|
- lib/rrsimple-rss.rb
|
25
|
+
- LICENSE
|
26
|
+
- Rakefile
|
27
|
+
- README.markdown
|
27
28
|
- rrsimple-rss.gemspec
|
28
29
|
- test/base/base_test.rb
|
29
|
-
- test/data/atom.xml
|
30
30
|
- test/data/bbc.xml
|
31
|
+
- test/data/atom.xml
|
31
32
|
- test/data/not-rss.xml
|
32
33
|
- test/data/rss09.rdf
|
33
34
|
- test/data/rss20.xml
|
34
35
|
- test/test_helper.rb
|
35
36
|
homepage: http://github.com/rrmartins/simple-rss
|
36
37
|
licenses: []
|
37
|
-
metadata: {}
|
38
38
|
post_install_message:
|
39
39
|
rdoc_options: []
|
40
40
|
require_paths:
|
41
41
|
- lib
|
42
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
43
44
|
requirements:
|
44
45
|
- - ! '>='
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
48
50
|
requirements:
|
49
51
|
- - ! '>='
|
50
52
|
- !ruby/object:Gem::Version
|
51
53
|
version: '0'
|
52
54
|
requirements: []
|
53
55
|
rubyforge_project: rrsimple-rss
|
54
|
-
rubygems_version:
|
56
|
+
rubygems_version: 1.8.23.2
|
55
57
|
signing_key:
|
56
|
-
specification_version:
|
58
|
+
specification_version: 3
|
57
59
|
summary: A simple, flexible, extensible, and liberal RSS and Atom reader for Ruby.
|
58
60
|
It is designed to be backwards compatible with the standard RSS parser, but will
|
59
61
|
never do RSS generation.
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
MjNlYjg4YmU4YWM5YjMwMWY3NGM1Y2E2MzFmMDUxMDVjNThiZmQwNg==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDE2NDA2NzZmNTZhZDFkYTI5ZjdhYWZhMDM2YTViMjhhNjRkMTMyNw==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MTBkMGRmNTBiOWNlNDVmY2FjMzM4ZjQ4YTQ3NmIyYTYyZDNjNTIzMDI1N2M0
|
10
|
-
OWQyMWFjYjE4NzU5OWEzN2MxMmY5YmQ4ZjA2YWI3MzMyYWJjZDdkYTdmNDkw
|
11
|
-
YjlhOTZmYmM5YThmY2M0YzE2ZWZmNzE1YTg4MmMyYTViNzVmMjQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MWY0M2E5MDQ3OGQwYjg5YzQ4OTQzMmRiY2JjYTc1YzA5N2U0MzEzYWQwYTY4
|
14
|
-
ZTk4ZTVkZWJhZTY2ZjFjMDgxOTA0OTE0ZmY3YjE0NTI1NjI1NWI2MjcyNWZl
|
15
|
-
YzJjODQ5OWJmNzk0YTZkMGI0YjhmYmNiMjBmOTRkNjI0ZGYyMTc=
|