feedparser

What is it?

An RSS and Atom feed parser, using expat via the luaExpat binding. Similar to the Mark Pilgrim's Universal Feed Parser, but less good.

Installation

You'll need LuaExpat for this to work. You may get it at http://luaforge.net/frs/?group_id=13.

Once that's done, download feedparser over at Luaforge.

untar the archive, edit the Makefile to match your Lua installation, run make, and make install. make test is nice. too. Pretty standard fare stuff.

Reference:

feedparser.parse( xml_string, [ base_url ] )
returns a table generated from the feed described by the xml_string parameter. Quite similar to the Univeral Feed Parser's output, with a few exception listed below. Optionally, base_url may be provides as the source url of the feed. It's useful when resolving relative links found in the feed.
feedparser.XMLElement
Just a little helper thingy. Don't mind it.
feedparser.url
url parser. same as LuaSocket's socket.url
feedparser.dateparser.parse( date_string )
parses RFC2822 and W3CDTF formatted date strings.

Usage

feedparser.parse(str) returns a parsed feed table, formatted the same for both Atom and RSS feeds. The output for a parsed feed is similar enough that you may consult his site for reference Here's a brief example

an example: require"feedparser" local parsed, err = feedparser.parse(some_fancy_feed_xml_string, "http://baseurl.example.org") assert(parsed, err) -- parsed is now a table conbtaining parsed feed information. it's quite similar to the Universal Feed Parser's output. -- some things are, however, missing: feed.info feed.info_detail feed.title_detail feed.subtitle_detail feed.rights_detail feed.textinput feed.cloud feed.publisher feed.publisher_detail feed.tags feed.ttl feed.licence feed.errorreportsto entries[i].title_detail entries[i].publisher entries[i].source entries[i].comments entries[i].licence namespaces encoding --this is pretty important, so will be implemented sooner than anything else status gref etag modified headers bozo bozo_exception