GithubHelp home page GithubHelp logo

ouattararomuald / syndication Goto Github PK

View Code? Open in Web Editor NEW
58.0 4.0 2.0 208 KB

A Kotlin library for reading RSS 2.0 and ATOM 1.0 syndication feeds.

License: Apache License 2.0

Kotlin 42.14% Java 57.86%
kotlin syndication atom-feed rss-feed syndication-feed

syndication's People

Contributors

gumichan01 avatar ouattararomuald avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

syndication's Issues

NULL when R8 optimization

Hello, When using R8 always get an exception with null when reading a RSS in the try catch block. If I don't use the problem does not happend. I don't understand if the problem is with an internal optimization that R8 tries to do., a Are you seen the same problem with R8 optimization eneabled ?

This is the part of the code:

fun getRssFedd(host:String):List<TwitterData>{

    val trustManager = TrustAllX509TrustManager.INSTANCE
    val client = OkHttpClient.Builder()
        .sslSocketFactory(
            sslContext(
                null,
                arrayOf<TrustManager>(trustManager)
            ).socketFactory,
            trustManager)
        .hostnameVerifier(TrustAllX509TrustManager.allowAllHostNames())
        .build()


    val mySyndication = Syndication(
        url = host,
        httpClient =client )
    val reader = mySyndication.create(RssReader::class.java)
    var lista : List<TwitterData>
    try {
        val rssFeed = reader.readRss()
        lista = convRssFeed(rssFeed)
    }
    catch (e:Exception){
        Log.e("Error reading RSS","${e.message}")
        lista = mutableListOf<TwitterData>()
    }
    return lista
}

Add possibility to parse custom syndication feed

In the current state, if the user wants to parse a feed that contains non-conventional fields, it is not possible. Also the API has lots of nullable fields, which is not very good for consumer.

It will be good to have some annotations:

  • @Atom
  • @Rss

that can be used to mark custom classes. If a class is marked with the annotations above then the adapters will not enforce the return type to be AtomFeed or RssFeed.

Usage:

@Atom
data class MyRss(
  @param:Element
  @field:Element
  val channel: MyChannel
)

and you're now able to have an interface like this:

@Atom
interface MyReader {
  fun readRss(): MyRss
}

Because we all have responsibilities, we trust you on the implementation of your custom class (MyRss here).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.