* Snownews 1.5.12

How to write scripts to use with Snownews and Liferea

There are generally two types of scripts. The ones called "filters" receive data from stdin, convert it to a valid RSS document and output it again to stdout. The data is piped through this type of extension. The second ones are called "execurls". These are scripts that generate a valid RSS feed all of their own. Just calling this script must print RSS to stdout. Please see the documents about Snownews and Liferea about how to add these extensions to your system.

The extensions can be written in any language. It must be an executable that can be run from a shell. No other restrictions exist.

Examples of filter extensions:

These can be used for converting a non-RSS syndication format to RSS on the fly so it can be added just like any other feed. This automatically takes advantages of Snownews' HTTP client and its features for resource downloading. See the extension heise2rss as an example for coding with filters. This extension was written by me and converts the front page of www.heise.de into a working RSS feed. At least at the time of writing this document here.

Liferea can also use these extensions as of version 0.4.9. See the Liferea specific documentations.

Examples of execurl extensions:

You can probably do anything with these. You could for example convert your inbox into an RSS feed and watch it inside your RSS reader. An example for this type of extension is the following Perl script which creates a simple RSS feed.


#!/usr/bin/perl
print <<EOF
<?xml version="1.0" ?>

<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/">

<channel rdf:about="http://some.url/">
<title>execurl test feed</title>
<link></link>
<description>execurl test feed</description>

</channel>

<item rdf:about="1">
<title>item 1</title>
<link>1</link>
<description>
item 1
</description>

</item>

</rdf:RDF>
EOF

Scripting for the rest of you

There is a project call script4rss on Sourceforge which simplifies script writing if you don't want to dive into messy Perl scripts.

« back

Script writing HOWTO