All Projects → nmdias → Feedkit

nmdias / Feedkit

Licence: mit
An RSS, Atom and JSON Feed parser written in Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Feedkit

buran
Bidirectional, data-driven RSS/Atom feed consumer, producer and feeds aggregator
Stars: ✭ 27 (-96.98%)
Mutual labels:  atom, rss, rss-reader
Feedreader
C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Tested with multiple languages and feeds.
Stars: ✭ 180 (-79.89%)
Mutual labels:  rss, rss-reader, atom
Pluto
pluto gems - planet feed reader and (static) website generator - auto-build web pages from published web feeds
Stars: ✭ 174 (-80.56%)
Mutual labels:  rss, rss-reader, atom
FeedReader
C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Tested with multiple languages and feeds.
Stars: ✭ 221 (-75.31%)
Mutual labels:  atom, rss, rss-reader
webfeed
A dart package for parsing RSS & Atom feed
Stars: ✭ 92 (-89.72%)
Mutual labels:  atom, rss, rss-reader
json-feed-viewer
The world's first JSON feed viewer 🥇
Stars: ✭ 40 (-95.53%)
Mutual labels:  atom, rss, rss-reader
Gorss
Go Terminal Feed Reader
Stars: ✭ 191 (-78.66%)
Mutual labels:  rss, rss-reader, atom
baRSS
Menu Bar RSS reader for macOS
Stars: ✭ 39 (-95.64%)
Mutual labels:  atom, rss, rss-reader
Liferea
Liferea (Linux Feed Reader), a news reader for GTK/GNOME
Stars: ✭ 612 (-31.62%)
Mutual labels:  rss, rss-reader, atom
Hexo Generator Feed
Feed generator for Hexo.
Stars: ✭ 400 (-55.31%)
Mutual labels:  rss, atom
Picofeed
PHP library to parse and write RSS/Atom feeds
Stars: ✭ 439 (-50.95%)
Mutual labels:  rss, atom
Netnewswire
RSS reader for macOS and iOS.
Stars: ✭ 5,105 (+470.39%)
Mutual labels:  rss, rss-reader
Reader
Free and open source feeds reader, including all major Google Reader features
Stars: ✭ 347 (-61.23%)
Mutual labels:  rss, atom
Stringer
A self-hosted, anti-social RSS reader.
Stars: ✭ 3,362 (+275.64%)
Mutual labels:  rss, rss-reader
Jquery Rss
An easy-to-use rss plugin for jquery with templating.
Stars: ✭ 443 (-50.5%)
Mutual labels:  rss, atom
Rssmonster
Google Reader inspired self-hosted RSS reader written in VueJS with an Express NodeJS backend. RSSMonster is compatible with the Fever API.
Stars: ✭ 321 (-64.13%)
Mutual labels:  rss, rss-reader
Feed
A RSS, Atom and JSON Feed generator for Node.js, making content syndication simple and intuitive! 🚀
Stars: ✭ 523 (-41.56%)
Mutual labels:  rss, atom
News
📰 RSS/Atom feed reader
Stars: ✭ 524 (-41.45%)
Mutual labels:  rss, rss-reader
Freshrss
A free, self-hostable aggregator…
Stars: ✭ 3,793 (+323.8%)
Mutual labels:  rss, rss-reader
Python Feedgen
Python module to generate ATOM feeds, RSS feeds and Podcasts.
Stars: ✭ 501 (-44.02%)
Mutual labels:  rss, atom

FeedKit

build status cocoapods compatible carthage compatible language swift

Features

Requirements

xcode ios tvos watchos mac os mac os

Installation >> instructions <<

Usage

Build a URL pointing to an RSS, Atom or JSON Feed.

let feedURL = URL(string: "http://images.apple.com/main/rss/hotnews/hotnews.rss")!

Get an instance of FeedParser

let parser = FeedParser(URL: feedURL) // or FeedParser(data: data) or FeedParser(xmlStream: stream)

Then call parse or parseAsync to start parsing the feed...

A common scenario in UI environments would be parsing a feed asynchronously from a user initiated action, such as the touch of a button. e.g.

// Parse asynchronously, not to block the UI.
parser.parseAsync(queue: DispatchQueue.global(qos: .userInitiated)) { (result) in
    // Do your thing, then back to the Main thread
    DispatchQueue.main.async {
        // ..and update the UI
    }
}

Remember, you are responsible to manually bring the result closure to whichever queue is apropriate. Usually to the Main thread, for UI apps, by calling DispatchQueue.main.async .

Alternatively, you can also parse synchronously.

let result = parser.parse()

Parse Result

FeedKit adopts Swift 5 Result type, as Result<Feed, ParserError>, and as such, if parsing succeeds you should now have a Strongly Typed Model of an RSS, Atom or JSON Feed, within the Feed enum:

switch result {
case .success(let feed):
    
    // Grab the parsed feed directly as an optional rss, atom or json feed object
    feed.rssFeed
    
    // Or alternatively...
    switch feed {
    case let .atom(feed):       // Atom Syndication Format Feed Model
    case let .rss(feed):        // Really Simple Syndication Feed Model
    case let .json(feed):       // JSON Feed Model
    }
    
case .failure(let error):
    print(error)
}

Model Preview

The RSS and Atom feed Models are rather extensive throughout the supported namespaces. These are just a preview of what's available.

RSS

feed.title
feed.link
feed.description
feed.language
feed.copyright
feed.managingEditor
feed.webMaster
feed.pubDate
feed.lastBuildDate
feed.categories
feed.generator
feed.docs
feed.cloud
feed.rating
feed.ttl
feed.image
feed.textInput
feed.skipHours
feed.skipDays
//...
feed.dublinCore
feed.syndication
feed.iTunes
// ...

let item = feed.items?.first

item?.title
item?.link
item?.description
item?.author
item?.categories
item?.comments
item?.enclosure
item?.guid
item?.pubDate
item?.source
//...
item?.dublinCore
item?.content
item?.iTunes
item?.media
// ...

Atom

feed.title
feed.subtitle
feed.links
feed.updated
feed.authors
feed.contributors
feed.id
feed.generator
feed.icon
feed.logo
feed.rights
// ...

let entry = feed.entries?.first

entry?.title
entry?.summary
entry?.authors
entry?.contributors
entry?.links
entry?.updated
entry?.categories
entry?.id
entry?.content
entry?.published
entry?.source
entry?.rights
// ...

JSON

feed.version
feed.title
feed.homePageURL
feed.feedUrl
feed.description
feed.userComment
feed.nextUrl
feed.icon
feed.favicon
feed.author
feed.expired
feed.hubs
feed.extensions
// ...

let item = feed.items?.first

item?.id
item?.url
item?.externalUrl
item?.title
item?.contentText
item?.contentHtml
item?.summary
item?.image
item?.bannerImage
item?.datePublished
item?.dateModified
item?.author
item?.url
item?.tags
item?.attachments
item?.extensions
// ...

License

FeedKit is released under the MIT license. See LICENSE for details.

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].