Skip to content
A feed parsing module for Nim
Branch: master
Clone or download
Latest commit 30ed073 May 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src [RSS] CData fix May 17, 2019
tests [RSS] CData fix May 17, 2019
.gitignore GitIgnore DS_Store May 8, 2019
FeedNim.nimble
LICENSE Initial commit May 7, 2019
README.md Formatting fix May 17, 2019
logo.png Another go at the logo May 7, 2019
logo.svg Logo - that's important, right? May 7, 2019

README.md

Feed-Nim

A feed parsing module for Nim, which parses RSS, Atom, and JSONfeed syndication formats. This has been substantially re-written and expanded from 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: <item> is accessed as .items[index]
RSS and Atom: <category> is accessed as .categories[index]
Atom: <entry> is accessed as .entries[index]
Atom: <author> is accessed as .authors[index] (if you call just .author, you will return the first author of the sequence)
Atom: <contributor> 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:

<link type=""> type is accesed with .linkType
<content type="">, <title type="">, and <subtitle type=""> 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).

You can’t perform that action at this time.