# Feed-Nim
A feed parsing module for [Nim](https://nim-lang.org), which parses RSS, Atom, and JSONfeed syndication formats. This has been substantially re-written and expanded from [Nim-RSS](https://github.com/achesak/nim-rss).
It has not been tested in the wild, and is mostly written by an inexperienced dope who barely understands Nim. It will probably break. Use at your own risk.
## Intallation
nimble install feednim
## Usage
loadAtom(filename: string): Atom Loads the Atom from the given _filename_ getAtom(url: string): Atom Gets the Atom from the specified _url_ loadRSS(filename: string): RSS Loads the RSS from the given _filename_ getRSS(url: string): RSS Gets the RSS from the specified _url_ loadJsonFeed(filename: string): JSONfeed Loads the JSONFeed from the given _filename_ getJsonFeed(url: string): JSONfeed Gets the JSONfeed from the specified _url_
### Accessors
Feed-Nim will give a data tree which looks very similar to the data tree of the feed, and the nodes will mostly have the same names. For example an RSS feed 'title' node will be:
`let feed = loadRSS("my_feed.xml")`
`feed.title # Will hold the title` (Bet you didn't see that coming!)
There are some exeptions, elements that can be repeated according to the specifications are pluralised as follows:
*RSS*: `` is accessed as `.items[index]`
*RSS and Atom*: `` is accessed as `.categories[index]`
*Atom*: `` is accessed as `.entries[index]`
*Atom*: `` is accessed as `.authors[index]` (if you call just `.author`, you will return the first author of the sequence)
*Atom*: `` is accessed as `.contributors[index]` (again, calling this singular will return the first in the sequence)
Some Atom nodes have the Nim keyword 'type' as an attribute. These have been changed as follows:
`` type is accesed with `.linkType`
``, ``, and `` types are accesed with `.textType`
### Limitations
Feed-Nim does not implement the full specification of any of the feed types. Notably, in Atom, the common attributes 'xml:lang' and 'xml:base' are not implemented. All three formats are extensible, but there is no support for this (extensions _should_ be ignored by Feed-Nim, but this is untested).