Skip to main content

Top Android RSS Parser Libraries

Let us explore some useful open source Android RSS parsing libraries. You can use these to easily create a news application, by fetching and parsing RSS Feeds.

What is RSS?

RSS stands for (Really Simple Syndication). RSS feed is an excellent way to ensure that content reaches a wider audience.

It is a type of XML (Extensible Markup Language) code that is used to syndicate content and share it with other websites.

What is RSS Feed?

An RSS feed is a web feed format used to publish frequently updated content to a reader or a website.

RSS Feeds provide a number of benefits for web users and developers. RSS Feeds allow web users to easily keep up to date with the latest content from a website or collection of websites. RSS Feeds allow users to quickly and easily view the latest updates from websites without needing to manually check for new content. This can save users time and effort, as well as allowing them to stay up to date with the latest content.

RSS Feeds can also be used by developers, to create an RSS Reader app. For example in this tutorial we are looking at libraries for creating sucg an app, a RSS reader app. Then users can use it to read latest news, and you developer can solve yet another problem for users.

What is an RSS Reader?

RSS Readers are an essential tool for the modern web user. They allow users to quickly and easily keep track of the latest news and content from the websites they visit most. By subscribing to a website's RSS feed, users can be alerted to new content immediately, allowing them to stay up-to-date with the latest information in their field of interest. In this blog post, we will explore what RSS readers are and how to use them for maximum benefit.

RSS Readers are web-based applications that allow users to subscribe to and manage RSS feeds from multiple websites. RSS readers allow users to follow the latest news and updates from the websites they visit most, without having to manually check each website for new content.

Here are the best libraries for creating an RSS reader app:

(a). RSS Parser

There is an Android library called RSS Parser that allows you to parse any RSS feed. Using RSS Parser, you can gather a great deal of useful information from any RSS channel, be it a blog, magazine, or even a podcast.

In order to avoid data waste due to very long feeds, the library provides a caching layer. Providing an expiration date is all you need to do.

You can obtain these data:

The RSS channel resulting object provides you with the following data:

  • Title
  • Description
  • Link
  • Articles
  • Image (Title, Url and Link)
  • Last build data
  • Update period
  • Itunes Data:
    • Author
    • Categories
    • Duration
    • Explicit
    • Image
    • Keywords
    • News Feed URL
    • Owner
    • Subtitle
    • Summary
    • Type

Articles, on the other hand, support the following attributes:

  • Title

  • Author

  • Description

  • Content

  • Image

  • Link

  • Publication Date

  • Categories

  • Audio

  • Source (name and URL)

  • GUID

  • Video

  • Itunes Data:

    • Author
    • Duration
    • Episode
    • Episode Type
    • Explicit
    • Image
    • Keywords
    • Subtitle
    • Summary

Step 1: Install it

You can install it using the following statement:


dependencies { implementation 'com.prof18.rssparser:rssparser:<latest-version>' } //e.g 5.0.0

The latest version can be found in maven here.

Step 2: Instantiate the Parse

First you instantiate the parser:


val parser = Parser.Builder()

.context(this)

.charset(Charset.forName("ISO-8859-7"))

.cacheExpirationMillis(24L 60L 60L * 1000L) // one day

.build()

Step 3: Fetch data

Then obtain data:


//url of RSS feed

private val url = "https://www.androidauthority.com/feed"

viewModelScope.launch {

try {

val channel = parser.getChannel(url)

// Do something with your data

} catch (e: Exception) {

e.printStackTrace()

// Handle the exception

}

}

Read more here

(b). ParseRSS

Here's a simple, concise, and extensible RSS parser. These are the things it can grab from RSS articles:

  • RSS Version based on https://validator.w3.org/feed/docs/

  • RSS Namespace Checking

    • Atom
    • [] DC
    • Media
    • RDF
    • [] SY
    • [] Specific namespaces
  • Channel

    • Title <title>
    • Description <description>
    • Link <link>
    • Publication Date <pubDate>
    • Image <image>
    • Language <language>
    • Copyright <copyright>
    • Rights <rights>
    • Last Build Date <lastBuildDate>
    • Atom Link <atom:link>
    • [] TimeToLive <ttl>
    • [] SkipHours <skipHours>
    • [] SkipDays <skipDays>
    • [] Managing Editor <managingEditor
  • Items Element

    • Title <title>
    • Description <description>
    • Link <link>
    • Item GUId <guid>
    • Media Content (NYT) <media:content>
    • Media Credit (NYT) <media:credit>
    • Media Description (NYT) <media:description>
    • Publication Date <pubDate>
    • Author <author>
    • Categories <category>
    • [] Source <source>
    • [] Enclosure <enclosure>
    • Atom Link <atom:link>
    • [] DC Creator (NYT) <dc:creator>
    • Comments <comments>

ParseRSS mainly has two main objects. RSSFeedObject and RSSItemObject. You can create your own parsing strategy by implementing RSSFeed and RSSItem.

ParseRSS depends on XmlPullParser, so feed it at least once in a lifetime. First thing first, the initialization part. You can put it on your Application onCreate function.

ParseRSS.init(XmlPullParserFactory.newInstance())

Be aware that XmlPullParser could throw an exception even in initialization step.

Next, feed the RSS string into ParseRSS

val feed: RSSFeedObject = ParseRSS.parse(xml)
feed.items.forEach {
print(it.title)
}

Usage with Retrofit

Convert Retrofit Response into RSSFeed by using ParseRSSConverterFactory

interface MyRssService {
@GET("rss")
fun rss(): Call<RSSFeedObject>
}
val retrofit = Retrofit.Builder()
.addConverterFactory(ParseRSSConverterFactory.create<RSSFeedObject>())
.baseUrl(BASE_URL)
.build()

val rssService = retrofit.create(MyRssService::class.java)
rssService.rss().enqueue(object : Callback<RSSFeedObject> {
override fun onFailure(call: Call<RSSFeedObject>, t: Throwable) {
}
override fun onResponse(call: Call<RSSFeedObject>, response: Response<RSSFeedObject>) {
}
})

Read more here.

(c). Earl

This is an Easy Android RSS (and also Atom) Library.

Here are its top features:

  • Using Earl, you can parse Atom and RSS 1.0/2.0
  • It supports RSS extensions (currently iTunes and Media RSS)
  • It's light. It's just a parser. The only dependencies are android annotations
  • Parser makes immutable POJOs that are easy to use
  • Compatible with Android 2.2 (API 8) and up

Installation

Install it:

implementation 'com.einmalfel:earl:1.2.0'

Usage

The use it:

InputStream inputStream = new URL(link).openConnection().getInputStream();
Feed feed = EarlParser.parseOrThrow(inputStream, 0);
Log.i(TAG, "Processing feed: " + feed.getTitle());
for (Item item : feed.getItems()) {
String title = item.getTitle();
Log.i(TAG, "Item title: " + (title == null ? "N/A" : title));
}

Read more here.

(d). KtRssReader

KtRssReader is a Kotlin library for parsing RSS feed.

Here are its features:

Android

  • Supports RSS 2.0 standard, iTunes, and Google Play tags
  • Easy-to-use API
  • Fetches feed for you
  • Database cache and custom cache valid time
  • Customizes output data with annotations

Kotlin

  • Supports RSS 2.0 standard, iTunes, and Google Play tags
  • Easy-to-use API
  • Customizes output data with annotations

How to Use KtRssReader?

Check out documentation for more information.

Android

Kotlin