Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A simple Java library for reading RSS and Atom feeds

License

NotificationsYou must be signed in to change notification settings

w3stling/rssreader

Repository files navigation

BuildDownloadJavadocLicense
CodeQLQuality GateCoverageBugsVulnerabilitiesCode Smells

Note

From version 3.0.0:

  • New Java package name
  • New group ID in Maven / Gradle dependency declaration
  • Moved repository fromJCenter 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.

Examples

Read RSS feed

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();

Read feed from a file

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

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())

Podcast / iTunes module

Use iTunes module for extracting data fromPodcast specific tags and attributes.

List<ItunesItem>items =newItunesRssReader().read(URL)                                              .toList();

Custom RSS / Atom feed extensions

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();

Download

Downloadthe latest JAR or grab viaMaven orGradle.

Maven setup

Add dependency declaration:

<project>    ...    <dependencies>        <dependency>            <groupId>com.apptasticsoftware</groupId>            <artifactId>rssreader</artifactId>            <version>3.9.1</version>        </dependency>    </dependencies>    ...</project>

Gradle setup

Add dependency declaration:

dependencies {    implementation'com.apptasticsoftware:rssreader:3.9.1'}

Markup Validation Services

Useful links for validating feeds

RSS / Atom

https://validator.w3.org/feed/
https://www.feedvalidator.org/check.cgi

Podcast / iTunes

https://podba.se/validate/
https://www.castfeedvalidator.com/

License

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.

[8]ページ先頭

©2009-2025 Movatter.jp