rssreader

w3stlingMIT活跃维护

轻量级 Java 库,用来解析和读取 RSS 与 Atom 订阅源,省去自己处理各种 feed 格式差异的麻烦。

A simple Java library for reading RSS and Atom feeds

v3.12.0发布于 2025-12-01 06:25 UTC201star25fork同步于 2026-11-10 06:06 UTC

怎么上手

README 里没有找到可直接复制的安装命令

README 里没有找到可直接复制的安装命令,请到 README 或官方文档查看安装方式。

硬件要求

README 没有说明硬件要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

这个项目的说明还在生成中,先参考下面「最近发版」和 README。

最近发版

5 个版本v3.12.0
  1. v3.12.0最新正式版2025-12-01 · 2025-12-01 06:25 UTC

    What's Changed

    🚀 Features

    • Add mapping for the xml:lang attribute in Atom feeds @w3stling (#281)
    • Add mapping for RDF image @w3stling (#280)
    • Add dc mappings @w3stling (#278)
    • Add mappings for skipDays and skipHours in RSS channel @w3stling (#271)
    • Replace invalid XML escape codes @w3stling (#270)

    🐛 Bug Fixes

    • Unhandled timestamp format @w3stling (#279)

    ♻️ Refactoring

    • Rename ZonedDateTime methods @w3stling (#288)

    📦 Dependencies

    • Bump org.junit.jupiter:junit-jupiter from 5.14.0 to 5.14.1 @dependabot[bot] (#273)
  2. v3.11.02025-10-20 · 2025-10-20 05:41 UTC
    查看更新说明

    What's Changed

    🚀 Features

    • Remove invalid XML character filter @w3stling (#263)
    • Add feed filtering functionality @w3stling (#262)

    📚 Documentation

    • Add documentation for feed filters @w3stling (#267)

    📦 Dependencies

    • Bump org.sonarqube from 6.3.1.5724 to 7.0.0.6105 @dependabot[bot] (#265)
    • Bump org.mockito:mockito-core from 5.18.0 to 5.20.0 @dependabot[bot] (#250)
    • Bump nl.jqno.equalsverifier:equalsverifier from 4.0.7 to 4.2 @dependabot[bot] (#255)
  3. v3.10.02025-08-02 · 2025-08-02 17:02 UTC
    查看更新说明

    What's Changed

    🚀 Features

    • Add mapping for dc:content @w3stling (#223)

    🐛 Bug Fixes

    • Unhandled timestamp format @w3stling (#238)

    📦 Dependencies

    • Bump org.mockito:mockito-core from 5.17.0 to 5.18.0 @dependabot[bot] (#224)
    • Bump org.junit.jupiter:junit-jupiter from 5.12.2 to 5.13.4 @dependabot[bot] (#236)
    • Bump nl.jqno.equalsverifier:equalsverifier from 3.19.3 to 4.0.7 @dependabot[bot] (#237)
    • Bump stefanzweifel/git-auto-commit-action from 5 to 6 @dependabot[bot] (#227)
    • Bump org.sonarqube from 6.1.0.5360 to 6.2.0.5505 @dependabot[bot] (#222)
  4. v3.9.32025-04-20 · 2025-04-20 19:27 UTC
    查看更新说明

    What's Changed

    🧰 Maintenance

    • Add jar manifest attributes @w3stling (#219)
  5. v3.9.22025-04-15 · 2025-04-15 05:20 UTC
    查看更新说明

    What's Changed

    🧰 Maintenance

    • Improve log message @w3stling (#213)

    📦 Dependencies

    • Bump nl.jqno.equalsverifier:equalsverifier from 3.17.4 to 3.19.3 @dependabot[bot] (#217)
    • Bump org.mockito:mockito-core from 5.14.2 to 5.17.0 @dependabot[bot] (#215)
    • Bump org.junit.jupiter:junit-jupiter from 5.11.3 to 5.12.2 @dependabot[bot] (#214)
    • Bump org.sonarqube from 6.0.1.5171 to 6.1.0.5360 @dependabot[bot] (#216)

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    RSS Reader

    Build Download Javadoc License
    CodeQL Quality Gate Coverage Bugs Vulnerabilities Code Smells

    [!NOTE] From version 3.0.0:

    • New Java package name
    • New group ID in Maven / Gradle dependency declaration
    • Moved repository from JCenter to Maven 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 a standardized, computer-readable format. It removes the need for the user to manually check the website for new content.

    Examples

    Read RSS feed

    Reads from a RSS (or Atom) feed.

    RssReader rssReader = new RssReader();
    List<Item> items = rssReader.read(URL)
                                .toList();
    

    Extract all items that contains the word football in the title.

    RssReader reader = new RssReader();
    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

    InputStream inputStream = new FileInputStream("/path/to/file");
    List<Item> items = new RssReader().read(inputStream);
                                      .toList();
    

    Reading from file using file URI

    List<Item> items = new RssReader().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); 
    new RssReader().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())
    

    Feed Filters

    Feed filters allow you to clean or transform RSS feed data before it is parsed. This is useful for handling malformed content, removing invalid characters, or applying custom preprocessing logic. Filters are applied to the raw InputStream of the feed, allowing for flexible transformations before parsing begins. Each filter must implement the FeedFilter interface. For example, to remove invalid XML characters from a feed before parsing:

    RssReader reader = new RssReader();
    List<Item> items = reader.addFeedFilter(new InvalidXmlCharacterFilter())
                             .read(URL)
                             .toList();
    

    Podcast / iTunes module

    Use iTunes module for extracting data from Podcast specific tags and attributes.

    List<ItunesItem> items = new ItunesRssReader().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 = new RssReader()
                 .addItemExtension("dc:creator", Item::setAuthor)
                 .addItemExtension("dc:date", Item::setPubDate)
                 .read("https://lwn.net/headlines/rss")
                 .toList();
    

    Download

    Download the latest JAR or grab via Maven or Gradle.

    Maven setup

    Add dependency declaration:

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

    Gradle setup

    Add dependency declaration:

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

    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 License
    
    Copyright (c) 2025, Apptastic Software
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, 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 THE
    SOFTWARE.