- Notifications
You must be signed in to change notification settings - Fork25
A simple Java library for reading RSS and Atom feeds
License
w3stling/rssreader
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Note
From version 3.0.0:
- New Java package name
- New group ID in Maven / Gradle dependency declaration
- Moved repository from
JCenter
toMaven Central Repository
RSS Reader is a simple Java library for reading RSS and Atom feeds. It has zero 3rd party dependencies, a low memory footprint and can process large feeds. Requires at minimum Java 11.
RSS (Rich Site Summary) is a type of web feed which allows users to access updates to online content in astandardized, computer-readable format. It removes the need for the user to manuallycheck the website for new content.
Reads from a RSS (or Atom) feed.
RssReaderrssReader =newRssReader();List<Item>items =rssReader.read(URL) .toList();
Extract all items that contains the word football in the title.
RssReaderreader =newRssReader();Stream<Item>rssFeed =reader.read(URL);List<Item>footballArticles =rssFeed.filter(i ->i.getTitle().equals(Optional.of("football"))) .toList();
Reading from file using InputStream
InputStreaminputStream =newFileInputStream("/path/to/file");List<Item>items =newRssReader().read(inputStream); .toList();
Reading from file using file URI
List<Item>items =newRssReader().read("file:/path/to/file"); .toList();
Read from multiple feeds into a single stream of items sorted in descending (newest first) publication date order and prints the title.
List<String>urls =List.of(URL1,URL2,URL3,URL4,URL5);newRssReader().read(urls) .sorted() .map(Item::getTitle) .forEach(System.out::println);
To change sort order to ascending (oldest first) publication date
.sorted(ItemComparator.oldestPublishedItemFirst())
For sorting on updated date instead of publication date
.sorted(ItemComparator.newestUpdatedItemFirst()).sorted(ItemComparator.oldestUpdatedItemFirst())
Use iTunes module for extracting data fromPodcast specific tags and attributes.
List<ItunesItem>items =newItunesRssReader().read(URL) .toList();
Support for mapping custom tags and attributes in feed to item and channel object.
List<Item>items =newRssReader() .addItemExtension("dc:creator",Item::setAuthor) .addItemExtension("dc:date",Item::setPubDate) .read("https://lwn.net/headlines/rss") .toList();
Downloadthe latest JAR or grab viaMaven orGradle.
Add dependency declaration:
<project> ... <dependencies> <dependency> <groupId>com.apptasticsoftware</groupId> <artifactId>rssreader</artifactId> <version>3.9.1</version> </dependency> </dependencies> ...</project>
Add dependency declaration:
dependencies { implementation'com.apptasticsoftware:rssreader:3.9.1'}
Useful links for validating feeds
https://validator.w3.org/feed/
https://www.feedvalidator.org/check.cgi
https://podba.se/validate/
https://www.castfeedvalidator.com/
MIT LicenseCopyright (c) 2024, Apptastic SoftwarePermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.
About
A simple Java library for reading RSS and Atom feeds