Skip to content

saro-lab/rss-stream-reader

Repository files navigation

RSS Stream Reader

Maven Central GitHub license

The RSS Stream Reader is very fast and performs real-time processing through the stream. Therefore, it can handle RSS without reading all of them. For example, by adding code to stop at duplicate items, it can end the stream without reading unnecessary duplicate items.

QUICK START

gradle kts

implementation("me.saro:rss-stream-reader:1.1")

gradle

compile "me.saro:rss-stream-reader:1.1"

maven

<dependency>
  <groupId>me.saro</groupId>
  <artifactId>rss-stream-reader</artifactId>
  <version>1.1</version>
</dependency>

Kotlin Example

// reader is thread-safe
val reader = RssStreamReader.Builder().build()
// normal
val rss = reader.url("https://test/rss.xml")

// print
println(rss)
println("- items")
rss.items.forEach(::println)
// stream stop
val rss = reader.url("https://test/rss.xml") { item, channel ->
    if (lastLink == item.link) {
        // The RSS feed stream has been stopped because the RSS feed items are duplicated.
        return@url false
    }
    true
}

Java Example

// reader is thread-safe
RssStreamReader reader = new RssStreamReader.Builder().build();
// normal
var rss = reader.url("https://test/rss.xml");

// print
System.out.println(rss);
System.out.println("- items");
rss.getItems().stream().forEach(System.out::println);
// stream stop
var rss = reader.url("https://test/rss.xml", (item, channel) -> {
    if (lastLink.equals(item.getLink())) {
        // The RSS feed stream has been stopped because the RSS feed items are duplicated.
        return false;
    }
    return true;
});

test code

repository

see

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published