simple-rss 2.2.0 → 2.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +174 -0
- data/README.md +492 -8
- data/Rakefile +1 -1
- data/examples/digest.rb +19 -0
- data/examples/discover.rb +14 -0
- data/examples/feedbag.rb +10 -0
- data/lib/simple-rss/discovery.rb +107 -0
- data/lib/simple-rss/entry_normalizer.rb +356 -0
- data/lib/simple-rss/http_client.rb +216 -0
- data/lib/simple-rss/json_entry_normalizer.rb +147 -0
- data/lib/simple-rss/json_feed.rb +176 -0
- data/lib/simple-rss/normalized_entry.rb +79 -0
- data/lib/simple-rss/request_errors.rb +21 -0
- data/lib/simple-rss/request_policy.rb +72 -0
- data/lib/simple-rss/xml_element.rb +136 -0
- data/lib/simple-rss.rb +225 -77
- data/simple-rss.gemspec +5 -5
- data/test/base/category_parsing_test.rb +217 -0
- data/test/base/date_ordering_test.rb +95 -0
- data/test/base/discovery_dependency_test.rb +29 -0
- data/test/base/discovery_test.rb +151 -0
- data/test/base/discovery_transport_test.rb +413 -0
- data/test/base/enumerable_test.rb +16 -0
- data/test/base/feedbag_integration_test.rb +21 -0
- data/test/base/json_feed_test.rb +372 -0
- data/test/base/normalized_entries_test.rb +410 -0
- data/test/base/normalized_fetch_test.rb +132 -0
- data/test/base/relation_links_test.rb +162 -0
- data/test/data/atom_categories.xml +23 -0
- data/test/data/atom_nested_link.xml +13 -0
- data/test/data/discovery.html +28 -0
- data/test/data/json_feed_1.json +75 -0
- data/test/data/json_feed_1_1.json +78 -0
- data/test/data/mixed_dates.xml +55 -0
- data/test/data/normalized_atom.xml +22 -0
- data/test/data/normalized_rss.xml +21 -0
- data/test/data/rss_categories.xml +15 -0
- data/test/support/http_server.rb +44 -0
- data/test/support/replace_method.rb +14 -0
- metadata +42 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c7b9e5da9cf92d57a18f9d9a87559f81c500a645bfa9be1f724bac5fc5d3f90
|
|
4
|
+
data.tar.gz: 7be572c876e373e72a738d448f3b3d4de2b699db97c00058f13cfc0cbf6ea612
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 203475b2a2bb57ed2dc67b9664e61b4f368faf5484cc430ca8de70991bcf44276c735cecb78e2b020df82fccdb51d84936d9414f817e6afa1d1b4882b0b373f7
|
|
7
|
+
data.tar.gz: 0a2aea620cbebf1f7833de82dacdf2d2cafd67cb1baedf89c12ee91999234eeacd338f2ef1e6377a5784cba84095d8e807c386e0331c8926e86314da060daca9
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Entries through 2.2.0 were backfilled from Git history. Their dates identify
|
|
4
|
+
release tags or version-changing commits; older package publication dates can
|
|
5
|
+
differ. Linked source boundaries identify the evidence for each entry. The
|
|
6
|
+
repository begins with a 1.1 import, so earlier releases are not reconstructed.
|
|
7
|
+
|
|
8
|
+
## Unreleased
|
|
9
|
+
|
|
10
|
+
## 2.3.0 - 2026-09-14
|
|
11
|
+
|
|
12
|
+
- Reject non-string discovery inputs with `PolicyError` instead of
|
|
13
|
+
`NoMethodError` during HTTPS normalization.
|
|
14
|
+
- Reject overflowing JSON numbers instead of collapsing numeric identifiers to
|
|
15
|
+
`Infinity` or exposing extension data that cannot be serialized as JSON.
|
|
16
|
+
- Reject invalid UTF-8 in JSON Feed input before exposing strings that can fail
|
|
17
|
+
during serialization or downstream processing.
|
|
18
|
+
- Handle bodyless successful HTTP responses without `NoMethodError`: `fetch`
|
|
19
|
+
reports a malformed feed, while `discover` applies its usual empty-page or
|
|
20
|
+
parsing-error behavior.
|
|
21
|
+
- Reject out-of-range JSON Feed timestamp hours and offsets as normalization
|
|
22
|
+
issues instead of silently shifting dates or treating invalid offsets as UTC.
|
|
23
|
+
Use the Gregorian calendar consistently for historical JSON Feed timestamps.
|
|
24
|
+
- Add `SimpleRSS.discover` for advertised RSS, Atom, and JSON Feed links, using
|
|
25
|
+
optional Nokogiri HTML5 parsing. Return ordered, deduplicated candidates with
|
|
26
|
+
titles, type hints, and verification status; recognize direct empty feeds.
|
|
27
|
+
Default bare domains and protocol-relative discovery inputs to HTTPS.
|
|
28
|
+
Apply destination checks, address pinning, redirect credential stripping,
|
|
29
|
+
total HTTP timeouts, and streamed wire/decompressed-body limits. Existing
|
|
30
|
+
`fetch` callers can opt into the shared bounded transport with `network_policy`;
|
|
31
|
+
ordinary fetching retains its behavior. Include a tested Feedbag alternative.
|
|
32
|
+
([#61](https://github.com/cardmagic/simple-rss/issues/61))
|
|
33
|
+
- Accept self-closing empty RSS channels and Atom feeds in `parse` and `fetch`,
|
|
34
|
+
allowing direct-feed discovery to recognize them without requiring items.
|
|
35
|
+
|
|
36
|
+
- Parse JSON Feed 1.0 and 1.1 through `parse` and `fetch`, using the same
|
|
37
|
+
normalized entry interface as RSS/Atom. Support titleless and empty feeds,
|
|
38
|
+
inherited authors, opaque/numeric IDs, separate content and dates, tags, and
|
|
39
|
+
multiple attachments. Preserve original metadata and extensions in `raw_json`
|
|
40
|
+
and normalized entry `raw`; report recoverable date/number issues. Keep XML
|
|
41
|
+
serialization unchanged and reject JSON-to-XML conversion explicitly.
|
|
42
|
+
Validate supplied expiration flags as booleans so strings such as `"false"`
|
|
43
|
+
cannot be mistaken for expired feeds. Fetch detects JSON regardless of
|
|
44
|
+
Content-Type and retains conditional GET.
|
|
45
|
+
([#60](https://github.com/cardmagic/simple-rss/issues/60))
|
|
46
|
+
|
|
47
|
+
- Add `normalized_entries`, an optional immutable RSS/Atom view with consistent
|
|
48
|
+
article URLs, separate publication/update dates, typed content and summaries,
|
|
49
|
+
category terms, authors, and associated attachment metadata. Preserve raw
|
|
50
|
+
items, XML, field sources, and normalization issues without changing existing
|
|
51
|
+
access or serialization. Support per-call content/keyword mappings such as
|
|
52
|
+
`full-text`, with no global tag changes. Resolve relative URLs using `xml:base`
|
|
53
|
+
and a supplied or fetched source URL; fetch now retains the final response URL
|
|
54
|
+
and resolves relative redirects. ([#59](https://github.com/cardmagic/simple-rss/issues/59))
|
|
55
|
+
- Parse Atom 1.0 category terms from attributes, so scalar category access and
|
|
56
|
+
`array_tags: [:category]` work with `items_by_category`. Preserve source order
|
|
57
|
+
and duplicates, skip missing or blank terms, and resolve namespace declarations
|
|
58
|
+
within the current entry. Exclude categories in embedded content and source
|
|
59
|
+
metadata while preserving RSS category text and CDATA behavior.
|
|
60
|
+
([#56](https://github.com/cardmagic/simple-rss/issues/56))
|
|
61
|
+
- Use the first valid `pubDate`, `updated`, or `published` timestamp in
|
|
62
|
+
`latest`, `items_since`, and merge ordering. Malformed dates no longer make
|
|
63
|
+
`latest` raise or hide a valid fallback. Preserve the original field values,
|
|
64
|
+
retain source order for equal dates, and place undated entries after dated
|
|
65
|
+
entries, including those before 1970. Preserve merge identity rules and the
|
|
66
|
+
placement of unidentified entries. ([#62](https://github.com/cardmagic/simple-rss/pull/62))
|
|
67
|
+
- Make documented relation accessors such as `item.link_alternate` and
|
|
68
|
+
`item[:link_alternate]` return the link's `href`, including when attributes
|
|
69
|
+
precede `rel` or the link contains nested media. Keep relation matching within
|
|
70
|
+
direct child links of the current entry. Preserve legacy keys such as
|
|
71
|
+
`item[:"link+alternate"]` and the existing `item.link` behavior; hash and JSON
|
|
72
|
+
serialization now include both relation keys.
|
|
73
|
+
([#57](https://github.com/cardmagic/simple-rss/issues/57))
|
|
74
|
+
|
|
75
|
+
## 2.2.0 - 2026-03-29
|
|
76
|
+
|
|
77
|
+
- Add `feed_type`, feed validation through instance and class `valid?` methods,
|
|
78
|
+
and filtering with `items_since`, `items_by_category`, and `search`.
|
|
79
|
+
- Add instance and class `merge` methods to combine feeds, deduplicate identified
|
|
80
|
+
entries, and order them by date. Add `diff` to report added and removed entries
|
|
81
|
+
between feed snapshots.
|
|
82
|
+
- Add item `has_media?` and `media_url` helpers, feed-level `enclosures` and
|
|
83
|
+
`images` collections, and parsing for `media:description`, `itunes:duration`,
|
|
84
|
+
and `itunes:image#href`. Treat blank media URLs as absent when choosing a
|
|
85
|
+
usable URL. ([Source](https://github.com/cardmagic/simple-rss/compare/v2.1.0...v2.2.0))
|
|
86
|
+
|
|
87
|
+
## 2.1.0 - 2025-12-29
|
|
88
|
+
|
|
89
|
+
- Add `SimpleRSS.fetch` with timeouts, custom headers, redirects, and conditional
|
|
90
|
+
GET support. Expose ETag and Last-Modified values and return `nil` for a
|
|
91
|
+
`304 Not Modified` response.
|
|
92
|
+
- Add `as_json`, `to_json`, and `to_hash`, serializing time values as ISO 8601.
|
|
93
|
+
Add `to_xml` to generate RSS 2.0 or Atom output from a parsed feed.
|
|
94
|
+
- Include `Enumerable` so feeds support iteration, mapping, and filtering.
|
|
95
|
+
Add index access with `feed[index]` and date ordering with `latest(count)`.
|
|
96
|
+
([Source](https://github.com/cardmagic/simple-rss/compare/v2.0.0...v2.1.0))
|
|
97
|
+
|
|
98
|
+
## 2.0.0 - 2025-12-28
|
|
99
|
+
|
|
100
|
+
- Add the `array_tags` option to collect multiple values for selected item tags.
|
|
101
|
+
- Support extracting attributes from channel/feed and item/entry elements with
|
|
102
|
+
the `tag#attribute` syntax.
|
|
103
|
+
- Normalize parsed strings to UTF-8 and skip empty or whitespace-only tag
|
|
104
|
+
definitions that could make parsing hang.
|
|
105
|
+
- Add inline RBS type annotations, Steep validation, and GitHub Actions checks
|
|
106
|
+
for modern Ruby versions.
|
|
107
|
+
([Source](https://github.com/cardmagic/simple-rss/compare/f5e879b...v2.0.0))
|
|
108
|
+
|
|
109
|
+
## 1.3.3 - 2018-04-23
|
|
110
|
+
|
|
111
|
+
- Parse `media:content#duration`, making video duration available through
|
|
112
|
+
`media_content_duration`. Synchronize the gemspec and library version at
|
|
113
|
+
1.3.3. ([Source](https://github.com/cardmagic/simple-rss/compare/51f0eb6...f5e879b))
|
|
114
|
+
|
|
115
|
+
## 1.3.2 - 2015-08-17
|
|
116
|
+
|
|
117
|
+
- Stop forcing parsed content to binary encoding during unescaping. Apply CDATA
|
|
118
|
+
removal and whitespace trimming after either unescaping branch, and add UTF-8
|
|
119
|
+
fixture coverage. This date follows the version change in source;
|
|
120
|
+
[RubyGems](https://rubygems.org/gems/simple-rss/versions/1.3.2) records package
|
|
121
|
+
publication in April 2018.
|
|
122
|
+
([Source](https://github.com/cardmagic/simple-rss/compare/f3768bd...76a56c6))
|
|
123
|
+
|
|
124
|
+
## 1.3.1 - 2013-12-16
|
|
125
|
+
|
|
126
|
+
- Restore Ruby 1.8 compatibility by checking for `force_encoding` before calling
|
|
127
|
+
it while unescaping content.
|
|
128
|
+
([Source](https://github.com/cardmagic/simple-rss/commit/f3768bd))
|
|
129
|
+
|
|
130
|
+
## 1.3.0 - 2013-12-16
|
|
131
|
+
|
|
132
|
+
- Make dynamically generated feed accessors usable on Ruby 1.9 without changing
|
|
133
|
+
the visibility of private parser methods.
|
|
134
|
+
- Adjust regular expressions and encoding handling for Ruby 1.9, including
|
|
135
|
+
suppression of UTF-8 regexp warnings.
|
|
136
|
+
([Source](https://github.com/cardmagic/simple-rss/compare/aaf86ad...0e2ce64))
|
|
137
|
+
|
|
138
|
+
## 1.2.3 - 2010-07-06
|
|
139
|
+
|
|
140
|
+
- Add `tag#attribute` mapping for item child elements. Parse Media RSS content
|
|
141
|
+
URLs, types, dimensions, thumbnails, titles, credits, and categories through
|
|
142
|
+
the corresponding attribute and element accessors.
|
|
143
|
+
([Source](https://github.com/cardmagic/simple-rss/compare/0915f34...aaf86ad))
|
|
144
|
+
|
|
145
|
+
## 1.2.2 - 2009-06-22
|
|
146
|
+
|
|
147
|
+
- Replace evaluation of feed-field assignments with `instance_variable_set`
|
|
148
|
+
and generate feed readers directly. Copy the options hash when constructing
|
|
149
|
+
the parser. ([Source](https://github.com/cardmagic/simple-rss/commit/0915f34))
|
|
150
|
+
|
|
151
|
+
## 1.2.1 - 2009-06-22
|
|
152
|
+
|
|
153
|
+
- Introduce an options hash for `parse` and initialization, including a
|
|
154
|
+
`marshalable` option that skips feed-reader generation. This intermediate
|
|
155
|
+
version is recorded in Git; a package publication was not verified.
|
|
156
|
+
([Source](https://github.com/cardmagic/simple-rss/commit/c9757d2))
|
|
157
|
+
|
|
158
|
+
## 1.2 - 2009-02-25
|
|
159
|
+
|
|
160
|
+
- Add `tag+rel` matching and built-in Atom link relations for alternate, self,
|
|
161
|
+
edit, and replies links. Add `feedburner:origLink` support.
|
|
162
|
+
- Remove CDATA delimiters and trim whitespace even when percent-unescaping is
|
|
163
|
+
unnecessary. ([Source](https://github.com/cardmagic/simple-rss/compare/40f3ca5...fa54025))
|
|
164
|
+
|
|
165
|
+
## 1.1 - 2006-02-02
|
|
166
|
+
|
|
167
|
+
- Earliest repository import: parse RSS and Atom from strings or IO objects,
|
|
168
|
+
expose feed and item fields through method access, provide RSS/Atom aliases,
|
|
169
|
+
and allow callers to extend the recognized feed and item tags.
|
|
170
|
+
([Source](https://github.com/cardmagic/simple-rss/commit/437b6a6))
|
|
171
|
+
- Subsequent commits retaining version 1.1 make percent-unescaping conditional
|
|
172
|
+
and add gem packaging metadata. These changes postdate the initial import.
|
|
173
|
+
([Unescaping](https://github.com/cardmagic/simple-rss/commit/ac95fb4),
|
|
174
|
+
[packaging](https://github.com/cardmagic/simple-rss/commit/379f639))
|