|
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 | |
|---|
| 7 | import sys |
|---|
| 8 | import xml.dom.minidom |
|---|
| 9 | |
|---|
| 10 | # fill in people you don't like here - whatever is in the <author><name>... field |
|---|
| 11 | idiots = [] |
|---|
| 12 | |
|---|
| 13 | xml = xml.dom.minidom.parseString(sys.stdin.read()) |
|---|
| 14 | |
|---|
| 15 | feed = xml.getElementsByTagName("feed")[0] |
|---|
| 16 | for 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 | |
|---|
| 22 | print xml.toxml(encoding="UTF-8") |
|---|