| jclement.ca · jnews.py - Jeff's News Aggregator and Presenter | [ Home · Photoblog (Flickr) · Software · Twitter · Search Site ] |
| jnews.py - Jeff's News Aggregator and Presenter | [ Home · Photoblog (Flickr) · Albums · Photography · Woodworking · Software · Search Site ] |
| Version: | 1.2 |
| Author: | Jeff Clement |
| Status: | Active |
A tool to download news and comics and place in them in a custom page of your choosing.
Basically the syntax is as follows:
jnews.py -i infile -o outfile
The input file is your HTML template with embedded source tags which describe what source to pull from, options for it, and formatting info.
It's intended to replace the fantastic NewsClipper program which is written in Perl (Ugh) and is a bit more complicated (more powerful) and really slow. jnews.py is very lightweight and has no dependencies outside a modern Python interpreter. It should run happily on Windows and Linux.
Currently I have build news getters for Astronomy Picture of the Day, United Media (Dilbert), Ucomics.com, User Friendly, Slashdot, Wired and anything with an RSS feed. There is an example document in the source tarball (sample/sample) that should give you an idea how to use it. Basically you just create your template HTML file and embed a special source directive into it that names a handler, arguments for that handler (such as a strip name or rss feed url), and optionally formatting info for each item. Here are a few quick examples:
This one inserts slashdot headlines using my default output format for slashdot.
<source name="slashdot"></source>
This one does that same only now I'm specifying my own formatting for the slashdot headlines. I want a bulleted list. Notice the stuff in the source container is the HTML snippet that is repeated for each item the source returns. Also the list of fields varies per source. Look at the beginning of the appropriate handler file in the handlers folder for fields supported by that handler.
<ul> <source name="slashdot"> <li><<a href="%(link)s">%(title)s</a> - %(description)s</li> </source> </ul>
And some handlers take arguments.
<source name="unitedmedia" strip="dilbert"></source>
And sometimes we use both. ie. This pulls info from an the Python news RSS feed and displays just the headlines.
<ul> <source name="rss" url="http://www.python.org/channews.rdf"> <li><<a href="%(link)s">%(title)s</a></li> </source> </ul>
There is also a limit parameter than can be supplied to any source that will limit the number of rows of response to the first N rows. For example the following pulls the top 2 headlines from slashdot.
<source name="slashdot" limit="2"></source>
And that's it. There are some things it can't do right now (ie. putting articles from the same source into multiple columns) but it works and is small and simple. With the RSS feed you should be able to add a tonne of sources easily and if you have a custom source checkout handlers/BaseHandler for documentation on how to write your own.
This software is licensed under the BSD license. Please make sure you have read and understood this license before downloading this software!
Copyright (c) 2003, Jeffrey Clement All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| File | Size | Last Modified |
|---|---|---|
| jnews.py-0.9-src.tar.gz | 17.85 kb | Thu Sep 23 06:15:46 2004 |
| jnews.py-0.9-src.tar.gz.asc | 0.18 kb | Thu Sep 23 06:15:46 2004 |
| jnews.py-1.0-src.tar.gz | 26.71 kb | Thu Sep 23 06:15:47 2004 |
| jnews.py-1.0-src.tar.gz.asc | 0.18 kb | Thu Sep 23 06:15:47 2004 |
| jnews.py-1.1-src.tar.gz | 27.69 kb | Thu Sep 23 06:15:47 2004 |
| jnews.py-1.1-src.tar.gz.asc | 0.18 kb | Thu Sep 23 06:15:47 2004 |
| jnews.py-1.2-src.tar.gz | 29.03 kb | Thu Sep 23 06:15:48 2004 |
| jnews.py-1.2-src.tar.gz.asc | 0.18 kb | Thu Sep 23 06:15:47 2004 |
| jnews.py-snapshot.tar.gz | 29.03 kb | Thu Sep 23 06:15:48 2004 |