All Projects → muhrifqii → ParseRSS

muhrifqii / ParseRSS

Licence: MIT License
A cup of library to Parse RSS for android. Also available as a ConverterFactory for Retrofit & Fuel

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ParseRSS

RetrofitRssConverterFactory
A Retrofit 2 converter which parses Rss feeds
Stars: ✭ 73 (+329.41%)
Mutual labels:  retrofit2, retrofit2-converter
VideoPreLoading
Demo for video PreLoading/ PreCaching using ExoPlayer 2.13.3 in Android.
Stars: ✭ 61 (+258.82%)
Mutual labels:  retrofit2, retrofit2-converter
Fineract-CN-mobile
DEPRECATED project - Check the Apache fineract-cn-mobile project instead
Stars: ✭ 17 (+0%)
Mutual labels:  retrofit2
Retrofit2Rxjava2Download
这是用Retrofit2和Rxjava2搭配封装的下载文件。
Stars: ✭ 19 (+11.76%)
Mutual labels:  retrofit2
java-filecoin-api-client
An API client for Filecoin implemented in Java
Stars: ✭ 38 (+123.53%)
Mutual labels:  retrofit2
uv-index
This is a work-in-progress (🔧️) ultraviolet index viewer app for demonstrating Instant Apps + Kotlin + Dagger + MVP
Stars: ✭ 64 (+276.47%)
Mutual labels:  retrofit2
WanAndroid
一个简洁漂亮与众不同的WanAndroid客户端,欢迎下载体验(〃'▽'〃)。(A simple and beautiful Wanandroid client App.) MVVM + Dagger2 + DataBinding + Lifecycle + OkHttp + Retrofit2
Stars: ✭ 81 (+376.47%)
Mutual labels:  retrofit2
SunnyBeach
阳光沙滩APP
Stars: ✭ 60 (+252.94%)
Mutual labels:  retrofit2
NYTimesMostPopularArticles
A simple app to hit the NY Times Most Popular Articles API and show a list of articles, that shows details when items on the list are tapped (a typical master/detail app), also user able to browse/ add articles to favorite list that implements MVVM architecture using Dagger2, Retrofit, Coroutines, LiveData, RoomDatabase, Database Debugging, Data…
Stars: ✭ 38 (+123.53%)
Mutual labels:  retrofit2
libbra
A currency tracker app demonstration. It refreshes currency list every single second based on the main currency. In addition to that, main currency is selectable.
Stars: ✭ 45 (+164.71%)
Mutual labels:  retrofit2
Compose-BreakingBad
🧪 ☠︎ Jetpack Compose - Breaking Bad ☢︎
Stars: ✭ 26 (+52.94%)
Mutual labels:  retrofit2
store-apps-mvvm
Implementation component of Android Jetpack with clean architecture
Stars: ✭ 32 (+88.24%)
Mutual labels:  retrofit2
MockAppMVVM
A sample app structure using the MVVM architecture using Retrofit, Dagger2, LiveData, RxJava, ViewModel and Room.
Stars: ✭ 14 (-17.65%)
Mutual labels:  retrofit2
FuelSDK-Node-Auth
Node authentication library for accessing the Salesforce Marketing Cloud APIs. Used in REST and SOAP client
Stars: ✭ 14 (-17.65%)
Mutual labels:  fuel
Clean Marvel Kotlin
This repository contains a detailed sample app that implements Clean architecture and MVP in Kotlin using RxJava2, Retrofit
Stars: ✭ 27 (+58.82%)
Mutual labels:  retrofit2
KeyManager
Android application to manage SSH and GPG keys on GitHub written in Kotlin.
Stars: ✭ 15 (-11.76%)
Mutual labels:  retrofit2
BookReader
📕 "任阅" 网络小说阅读器,3D翻页效果、txt/pdf/epub书籍阅读、Wifi传书~
Stars: ✭ 6,113 (+35858.82%)
Mutual labels:  retrofit2
UdacityPopularMovies
An Android app, that helps you browse most popular and most rated movies. This project is created for Udacity Android Developer Nanodegree.
Stars: ✭ 26 (+52.94%)
Mutual labels:  retrofit2
Android-Mvi-Starter
Android MVI Starter application
Stars: ✭ 19 (+11.76%)
Mutual labels:  retrofit2
GitKtDroid
A sample Android application📱 built with Kotlin for #30DaysOfKotlin
Stars: ✭ 53 (+211.76%)
Mutual labels:  retrofit2

ParseRSS

CodeFactor codebeat badge

RSS Parser for android


Simple, concise, and extensible RSS Parser in the entire coffee shop. It can capture these information from the RSS article:

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

  • RSS Namespace Checking

    • Atom
    • DC
    • Media
    • Specific namespaces
  • Channel

    • Title <title>
    • Description <description>
    • Link <link>
    • Publication Date <pubDate>
    • Image <image>
    • Language <language>
    • Copyright <copyright>
    • 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.

Usage

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

ParseRSS as a Converter

ParseRSS does not have its own networking mechanism. Instead, it benefits from infamous networking library such as Retrofit, and Fuel. By using ConverterFactory, ParseRSS is ready to ship without breaking your project design pattern.

Fuel

Convert Fuel Response into RSSFeed by using responseRss function.

Fuel.get(URL).responseRss<RSSFeedObject> { result ->
  result.fold({ feed ->
    feed.items.forEach {
      print(it.title)
    }
  }, { error ->
    print(error)
  })
}

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>) {
    }
})

Gradle Dependency

Add jitpack repository in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Used on Fuel

// ParseRSS as Fuel Converter Factory
implementation "com.github.muhrifqii.ParseRSS:parserss:$version"
implementation "com.github.muhrifqii.ParseRSS:fuel:$version"

Used on Retrofit

// ParseRSS as Retrofit Converter Factory
implementation "com.github.muhrifqii.ParseRSS:parserss:$version"
implementation "com.github.muhrifqii.ParseRSS:retrofit:$version"

License

Copyright (c) 2019 Muhammad Rifqi Fatchurrahman

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].