root/confluence/feedfilters/planetfilter.py

Revision 543, 0.7 kB (checked in by confluence, 15 months ago)

Twitter filter; added description + licence to planet filter.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3# This filter removes people you don't like from an aggregated Planet feed.  Definitely works on Clug Park.
4# Written by Adrianna Pinska
5# Licence: GPLv3
6
7import sys
8import xml.dom.minidom
9
10# fill in people you don't like here - whatever is in the <author><name>... field
11idiots = []
12
13xml = xml.dom.minidom.parseString(sys.stdin.read())
14
15feed = xml.getElementsByTagName("feed")[0]
16for entry in feed.getElementsByTagName("entry"):
17    authorname = entry.getElementsByTagName("author")[0].getElementsByTagName("name")[0].firstChild.data
18    if authorname in idiots:
19        feed.removeChild(entry)
20        entry.unlink()
21
22print xml.toxml(encoding="UTF-8")
Note: See TracBrowser for help on using the browser.