[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Module to work with RSS
- From: Matthew Wild <mwild1@...>
- Date: Sun, 28 Nov 2010 14:17:24 +0000
On 28 November 2010 14:14, Luiz Henrique de Figueiredo
>> I'm looking for Lua module(s) to work with RSS.
> The code below parses http://www.lua.org/news.rss for instance.
> It may be a start.
> local function parse(name,t)
> local leaf=true
> for k,b in string.gmatch(t, "<(%w+).->(.-)</%1>") do
> if leaf then print(name,t) end
I used to use this code in a bot. It worked fine with some (especially
large) feeds, with other feeds it would use lots of CPU and/or RAM (it
was some years back, I can't remember) so I had to disable it. It's
certainly fine if you have a fixed feed that you know works and don't
want to add any dependencies, though for general-purpose feed parsing
it's probably better to go with a real XML parser.