Module to work with RSS

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Module to work with RSS

Alexander Gladysh
Hi, list!

I'm looking for Lua module(s) to work with RSS.

I want to write a simple RSS proxy service: fetch a feed, filter out
unwanted content by a simple set of rules, serve filtered feed.

Any advice?

Thanks,
Alexander.

P.S. All that because GitHub RSS is way too noisy, and I'm tired of
miss important events in that noise.

Reply | Threaded
Open this post in threaded view
|

Re: Module to work with RSS

Philippe Lhoste
On 28/11/2010 14:32, Alexander Gladysh wrote:
> I'm looking for Lua module(s) to work with RSS.
>
> I want to write a simple RSS proxy service: fetch a feed, filter out
> unwanted content by a simple set of rules, serve filtered feed.
>
> Any advice?

Should I would want to do that, I would use LuaSocket for HTTP stuff,
and any of the numerous Lua libraries (binding or pure Lua) to handle
XML. Perhaps along with one of the Lua HTTP servers to serve back the feed.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


Reply | Threaded
Open this post in threaded view
|

Re: Module to work with RSS

Luiz Henrique de Figueiredo
In reply to this post by Alexander Gladysh
> 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
                parse(name..k..".",b)
                leaf=false
        end
        if leaf then print(name,t) end
end

parse("",io.read"*a")

Reply | Threaded
Open this post in threaded view
|

Re: Module to work with RSS

Matthew Wild
In reply to this post by Alexander Gladysh
On 28 November 2010 13:32, Alexander Gladysh <[hidden email]> wrote:
> Hi, list!
>
> I'm looking for Lua module(s) to work with RSS.
>
> I want to write a simple RSS proxy service: fetch a feed, filter out
> unwanted content by a simple set of rules, serve filtered feed.
>

I never found anything, and so wrote: http://code.matthewwild.co.uk/lua-feeds

It only does Atom currently, but extending it to support RSS (sigh)
wouldn't be hard I hope. Re-serialization should be as easy with
stanza.lua.

I'm using it in a couple of projects which will need to support RSS
soon, but if you can't wait until then patches are welcome :)

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: Module to work with RSS

Matthew Wild
In reply to this post by Luiz Henrique de Figueiredo
On 28 November 2010 14:14, Luiz Henrique de Figueiredo
<[hidden email]> wrote:

>> 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
>                parse(name..k..".",b)
>                leaf=false
>        end
>        if leaf then print(name,t) end
> end
>
> parse("",io.read"*a")

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.

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: Module to work with RSS

Alexander Gladysh
In reply to this post by Matthew Wild
On Sun, Nov 28, 2010 at 17:15, Matthew Wild <[hidden email]> wrote:
> On 28 November 2010 13:32, Alexander Gladysh <[hidden email]> wrote:

>> I'm looking for Lua module(s) to work with RSS.

> I never found anything, and so wrote: http://code.matthewwild.co.uk/lua-feeds

> It only does Atom currently, but extending it to support RSS (sigh)
> wouldn't be hard I hope. Re-serialization should be as easy with
> stanza.lua.

It happens that I actually need Atom support, not RSS.

Did you thought about submitting a rockspec for your library?

Thanks,
Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Module to work with RSS

Matthew Wild
On 28 November 2010 21:06, Alexander Gladysh <[hidden email]> wrote:

> On Sun, Nov 28, 2010 at 17:15, Matthew Wild <[hidden email]> wrote:
>> On 28 November 2010 13:32, Alexander Gladysh <[hidden email]> wrote:
>
>>> I'm looking for Lua module(s) to work with RSS.
>
>> I never found anything, and so wrote: http://code.matthewwild.co.uk/lua-feeds
>
>> It only does Atom currently, but extending it to support RSS (sigh)
>> wouldn't be hard I hope. Re-serialization should be as easy with
>> stanza.lua.
>
> It happens that I actually need Atom support, not RSS.
>
> Did you thought about submitting a rockspec for your library?
>

As I said to Cosmin when he emailed me about getsize, I'm planning to
write rockspecs for all the projects on code.matthewwild.co.uk that it
makes sense for, I just haven't had time yet. In the long run I want
to replace the main page with a list of projects, each with its status
(e.g. alpha, beta, I'm-not-going-to-maintain-this, or current version
number), tarball (if one) and rockspec (if one).

Rockspec contributions are welcome, but don't worry about writing one
unless you need to, I'll probably automate the task when I get around
to it.

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: Module to work with RSS

Pierre Chapuis
In reply to this post by Alexander Gladysh
 On Sun, 28 Nov 2010 16:32:22 +0300, Alexander Gladysh
 <[hidden email]> wrote:

> I'm looking for Lua module(s) to work with RSS.

 I use https://github.com/slact/lua-feedparser and I'm quite happy with
 it.